mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
Cleanup - More Lambdas to method references
This commit is contained in:
@@ -51,12 +51,12 @@ public class BiomeEdit extends FormPanel {
|
||||
add(terrain);
|
||||
add(structures);
|
||||
|
||||
name.getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeEdit.this.updateTerrain()));
|
||||
tilesetName.getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeEdit.this.updateTerrain()));
|
||||
color.getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeEdit.this.updateTerrain()));
|
||||
name.getDocument().addDocumentListener(new DocumentChangeListener(BiomeEdit.this::updateTerrain));
|
||||
tilesetName.getDocument().addDocumentListener(new DocumentChangeListener(BiomeEdit.this::updateTerrain));
|
||||
color.getDocument().addDocumentListener(new DocumentChangeListener(BiomeEdit.this::updateTerrain));
|
||||
collision.addChangeListener(e -> BiomeEdit.this.updateTerrain());
|
||||
spriteNames.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeEdit.this.updateTerrain()));
|
||||
enemies.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeEdit.this.updateTerrain()));
|
||||
spriteNames.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(BiomeEdit.this::updateTerrain));
|
||||
enemies.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(BiomeEdit.this::updateTerrain));
|
||||
terrain.addChangeListener(e -> BiomeEdit.this.updateTerrain());
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class BiomeEdit extends FormPanel {
|
||||
startPointY.addChangeListener(e -> BiomeEdit.this.updateTerrain());
|
||||
noiseWeight.addChangeListener(e -> BiomeEdit.this.updateTerrain());
|
||||
distWeight.addChangeListener(e -> BiomeEdit.this.updateTerrain());
|
||||
tilesetAtlas.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeEdit.this.updateTerrain()));
|
||||
tilesetAtlas.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(BiomeEdit.this::updateTerrain));
|
||||
width.addChangeListener(e -> BiomeEdit.this.updateTerrain());
|
||||
height.addChangeListener(e -> BiomeEdit.this.updateTerrain());
|
||||
refresh();
|
||||
|
||||
@@ -135,8 +135,8 @@ public class BiomeStructureDataMappingEditor extends JComponent {
|
||||
add("color:",color);
|
||||
add("collision:",collision);
|
||||
|
||||
name.getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeStructureDataMappingEdit.this.update()));
|
||||
color.getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeStructureDataMappingEdit.this.update()));
|
||||
name.getDocument().addDocumentListener(new DocumentChangeListener(BiomeStructureDataMappingEdit.this::update));
|
||||
color.getDocument().addDocumentListener(new DocumentChangeListener(BiomeStructureDataMappingEdit.this::update));
|
||||
collision.addChangeListener(e -> BiomeStructureDataMappingEdit.this.update());
|
||||
refresh();
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BiomeStructureEdit extends FormPanel {
|
||||
add(center);
|
||||
add(data);
|
||||
|
||||
structureAtlasPath.getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeStructureEdit.this.updateStructure()));
|
||||
structureAtlasPath.getDocument().addDocumentListener(new DocumentChangeListener(BiomeStructureEdit.this::updateStructure));
|
||||
|
||||
|
||||
x.addChangeListener(e -> BiomeStructureEdit.this.updateStructure());
|
||||
@@ -55,8 +55,8 @@ public class BiomeStructureEdit extends FormPanel {
|
||||
randomPosition.addChangeListener(e -> BiomeStructureEdit.this.updateStructure());
|
||||
|
||||
N.addChangeListener(e -> BiomeStructureEdit.this.updateStructure());
|
||||
sourcePath.getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeStructureEdit.this.updateStructure()));
|
||||
maskPath.getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeStructureEdit.this.updateStructure()));
|
||||
sourcePath.getDocument().addDocumentListener(new DocumentChangeListener(BiomeStructureEdit.this::updateStructure));
|
||||
maskPath.getDocument().addDocumentListener(new DocumentChangeListener(BiomeStructureEdit.this::updateStructure));
|
||||
periodicInput.addChangeListener(e -> BiomeStructureEdit.this.updateStructure());
|
||||
ground.addChangeListener(e -> BiomeStructureEdit.this.updateStructure());
|
||||
symmetry.addChangeListener(e -> BiomeStructureEdit.this.updateStructure());
|
||||
|
||||
@@ -27,7 +27,7 @@ public class BiomeTerrainEdit extends FormPanel {
|
||||
center.add("resolution:",resolution);
|
||||
add(center,preview);
|
||||
|
||||
spriteName.getDocument().addDocumentListener(new DocumentChangeListener(() -> BiomeTerrainEdit.this.updateTerrain()));
|
||||
spriteName.getDocument().addDocumentListener(new DocumentChangeListener(BiomeTerrainEdit.this::updateTerrain));
|
||||
|
||||
min.addChangeListener(e -> BiomeTerrainEdit.this.updateTerrain());
|
||||
max.addChangeListener(e -> BiomeTerrainEdit.this.updateTerrain());
|
||||
|
||||
@@ -40,8 +40,8 @@ public class DialogOptionEdit extends FormPanel {
|
||||
|
||||
add(middle);
|
||||
|
||||
name.getDocument().addDocumentListener(new DocumentChangeListener(() -> DialogOptionEdit.this.updateDialog()));
|
||||
text.getDocument().addDocumentListener(new DocumentChangeListener(() -> DialogOptionEdit.this.updateDialog()));
|
||||
name.getDocument().addDocumentListener(new DocumentChangeListener(DialogOptionEdit.this::updateDialog));
|
||||
text.getDocument().addDocumentListener(new DocumentChangeListener(DialogOptionEdit.this::updateDialog));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class EditorMainWindow extends JFrame {
|
||||
BorderLayout layout=new BorderLayout();
|
||||
JToolBar toolBar = new JToolBar("toolbar");
|
||||
JButton newButton=new JButton("open ParticleEditor");
|
||||
newButton.addActionListener(e -> EventQueue.invokeLater(() ->new ParticleEditor()));
|
||||
newButton.addActionListener(e -> EventQueue.invokeLater(ParticleEditor::new));
|
||||
toolBar.add(newButton);
|
||||
setLayout(layout);
|
||||
toolBar.setFloatable(false);
|
||||
|
||||
@@ -42,8 +42,8 @@ public class EffectEditor extends JComponent {
|
||||
lifeModifier.addChangeListener(e -> EffectEditor.this.updateEffect());
|
||||
moveSpeed.addChangeListener(e -> EffectEditor.this.updateEffect());
|
||||
colorView.addChangeListener(e -> EffectEditor.this.updateEffect());
|
||||
name.getDocument().addDocumentListener(new DocumentChangeListener(() -> EffectEditor.this.updateEffect()));
|
||||
startBattleWithCard.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> EffectEditor.this.updateEffect()));
|
||||
name.getDocument().addDocumentListener(new DocumentChangeListener(EffectEditor.this::updateEffect));
|
||||
startBattleWithCard.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(EffectEditor.this::updateEffect));
|
||||
if(opponent!=null)
|
||||
|
||||
opponent.addChangeListener(e -> EffectEditor.this.updateEffect());
|
||||
|
||||
@@ -289,7 +289,7 @@ public class EnemyEdit extends FormPanel {
|
||||
tags.add(e.nextElement());
|
||||
}
|
||||
|
||||
tags.removeIf(q -> q.isEmpty());
|
||||
tags.removeIf(String::isEmpty);
|
||||
currentData.questTags = tags.toArray(currentData.questTags);
|
||||
QuestController.getInstance().refresh();
|
||||
filterExisting(enemyModel);
|
||||
|
||||
@@ -38,10 +38,10 @@ public class ItemEdit extends JComponent {
|
||||
add(effect);
|
||||
add(new Box.Filler(new Dimension(0,0),new Dimension(0,Integer.MAX_VALUE),new Dimension(0,Integer.MAX_VALUE)));
|
||||
|
||||
nameField.getDocument().addDocumentListener(new DocumentChangeListener(() -> ItemEdit.this.updateItem()));
|
||||
equipmentSlot.getDocument().addDocumentListener(new DocumentChangeListener(() -> ItemEdit.this.updateItem()));
|
||||
description.getDocument().addDocumentListener(new DocumentChangeListener(() -> ItemEdit.this.updateItem()));
|
||||
iconName.getDocument().addDocumentListener(new DocumentChangeListener(() -> ItemEdit.this.updateItem()));
|
||||
nameField.getDocument().addDocumentListener(new DocumentChangeListener(ItemEdit.this::updateItem));
|
||||
equipmentSlot.getDocument().addDocumentListener(new DocumentChangeListener(ItemEdit.this::updateItem));
|
||||
description.getDocument().addDocumentListener(new DocumentChangeListener(ItemEdit.this::updateItem));
|
||||
iconName.getDocument().addDocumentListener(new DocumentChangeListener(ItemEdit.this::updateItem));
|
||||
cost.addChangeListener(e -> ItemEdit.this.updateItem());
|
||||
questItem.addChangeListener(e -> ItemEdit.this.updateItem());
|
||||
effect.addChangeListener(e -> ItemEdit.this.updateItem());
|
||||
|
||||
@@ -58,18 +58,18 @@ public class RewardEdit extends FormPanel {
|
||||
probability.addChangeListener(e -> RewardEdit.this.updateReward());
|
||||
count.addChangeListener(e -> RewardEdit.this.updateReward());
|
||||
addMaxCount.addChangeListener(e -> RewardEdit.this.updateReward());
|
||||
cardName.getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
itemName.getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
editions.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
colors.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
rarity.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
subTypes.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
cardTypes.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
superTypes.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
manaCosts.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
keyWords.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
cardName.getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
itemName.getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
editions.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
colors.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
rarity.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
subTypes.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
cardTypes.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
superTypes.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
manaCosts.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
keyWords.getEdit().getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
colorType.addActionListener((e -> RewardEdit.this.updateReward()));
|
||||
cardText.getDocument().addDocumentListener(new DocumentChangeListener(() -> RewardEdit.this.updateReward()));
|
||||
cardText.getDocument().addDocumentListener(new DocumentChangeListener(RewardEdit.this::updateReward));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -427,7 +427,7 @@ public class EffectAi extends SpellAbilityAi {
|
||||
if (sa.usesTargeting() && !sa.getTargetRestrictions().canTgtPlayer()) {
|
||||
// try to target the opponent's best targetable permanent, if able
|
||||
CardCollection oppPerms = CardLists.getValidCards(aiPlayer.getOpponents().getCardsIn(sa.getTargetRestrictions().getZone()), sa.getTargetRestrictions().getValidTgts(), aiPlayer, sa.getHostCard(), sa);
|
||||
oppPerms = CardLists.filter(oppPerms, card -> sa.canTarget(card));
|
||||
oppPerms = CardLists.filter(oppPerms, sa::canTarget);
|
||||
if (!oppPerms.isEmpty()) {
|
||||
sa.resetTargets();
|
||||
sa.getTargets().add(ComputerUtilCard.getBestAI(oppPerms));
|
||||
@@ -437,7 +437,7 @@ public class EffectAi extends SpellAbilityAi {
|
||||
if (mandatory) {
|
||||
// try to target the AI's worst targetable permanent, if able
|
||||
CardCollection aiPerms = CardLists.getValidCards(aiPlayer.getCardsIn(sa.getTargetRestrictions().getZone()), sa.getTargetRestrictions().getValidTgts(), aiPlayer, sa.getHostCard(), sa);
|
||||
aiPerms = CardLists.filter(aiPerms, card -> sa.canTarget(card));
|
||||
aiPerms = CardLists.filter(aiPerms, sa::canTarget);
|
||||
if (!aiPerms.isEmpty()) {
|
||||
sa.resetTargets();
|
||||
sa.getTargets().add(ComputerUtilCard.getWorstAI(aiPerms));
|
||||
|
||||
@@ -323,7 +323,7 @@ public final class ImageKeys {
|
||||
}
|
||||
public static boolean hasSetLookup(String filename) {
|
||||
if (!StaticData.instance().getSetLookup().isEmpty()) {
|
||||
return StaticData.instance().getSetLookup().keySet().stream().anyMatch(setKey -> filename.startsWith(setKey));
|
||||
return StaticData.instance().getSetLookup().keySet().stream().anyMatch(filename::startsWith);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -1602,7 +1602,7 @@ public class CardProperty {
|
||||
if (!(property.contains("LKI") ? lki : card).isAttacking()) return false;
|
||||
if (property.equals("attacking")) return true;
|
||||
if (property.endsWith("Alone")) {
|
||||
return CardLists.count(card.getGame().getLastStateBattlefield(), c -> c.isAttacking()) == 1;
|
||||
return CardLists.count(card.getGame().getLastStateBattlefield(), Card::isAttacking) == 1;
|
||||
}
|
||||
if (property.equals("attackingYou")) return combat.isAttacking(card, sourceController);
|
||||
if (property.equals("attackingSame")) {
|
||||
|
||||
@@ -52,8 +52,8 @@ public class DeckSelectScene extends UIScene {
|
||||
back = ui.findActor("return");
|
||||
edit = ui.findActor("edit");
|
||||
rename = ui.findActor("rename");
|
||||
ui.onButtonPress("return", () -> DeckSelectScene.this.back());
|
||||
ui.onButtonPress("edit", () -> DeckSelectScene.this.edit());
|
||||
ui.onButtonPress("return", DeckSelectScene.this::back);
|
||||
ui.onButtonPress("edit", DeckSelectScene.this::edit);
|
||||
ui.onButtonPress("rename", () -> {
|
||||
textInput.setText(Current.player().getSelectedDeck().getName());
|
||||
showRenameDialog();
|
||||
|
||||
@@ -173,10 +173,10 @@ public class NewGameScene extends MenuScene {
|
||||
gender.setCurrentIndex(rand.nextInt());
|
||||
colorId.setCurrentIndex(rand.nextInt());
|
||||
race.setCurrentIndex(rand.nextInt());
|
||||
ui.onButtonPress("back", () -> NewGameScene.this.back());
|
||||
ui.onButtonPress("start", () -> NewGameScene.this.start());
|
||||
ui.onButtonPress("leftAvatar", () -> NewGameScene.this.leftAvatar());
|
||||
ui.onButtonPress("rightAvatar", () -> NewGameScene.this.rightAvatar());
|
||||
ui.onButtonPress("back", NewGameScene.this::back);
|
||||
ui.onButtonPress("start", NewGameScene.this::start);
|
||||
ui.onButtonPress("leftAvatar", NewGameScene.this::leftAvatar);
|
||||
ui.onButtonPress("rightAvatar", NewGameScene.this::rightAvatar);
|
||||
difficultyHelp.addListener(new ClickListener(){ public void clicked(InputEvent e, float x, float y){ showDifficultyHelp(); }});
|
||||
modeHelp.addListener(new ClickListener(){ public void clicked(InputEvent e, float x, float y){ showModeHelp(); }});
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class SpellSmithScene extends UIScene {
|
||||
}
|
||||
}
|
||||
|
||||
ui.onButtonPress("done", () -> SpellSmithScene.this.done());
|
||||
ui.onButtonPress("done", SpellSmithScene.this::done);
|
||||
ui.onButtonPress("pullUsingGold", () -> SpellSmithScene.this.pullCard(false));
|
||||
ui.onButtonPress("pullUsingShards", () -> SpellSmithScene.this.pullCard(true));
|
||||
ui.onButtonPress("BReset", () -> {
|
||||
|
||||
@@ -123,11 +123,11 @@ public class KeyBoardDialog extends Dialog {
|
||||
key0 = Controls.newTextButton("0", () -> kbLabel.setText(kbLabel.getText()+"0"));
|
||||
keyDot = Controls.newTextButton(".", () -> kbLabel.setText(kbLabel.getText()+"."));
|
||||
keyComma = Controls.newTextButton(",", () -> kbLabel.setText(kbLabel.getText()+","));
|
||||
keyShift = Controls.newTextButton("Aa", () -> shiftKey());
|
||||
keyShift = Controls.newTextButton("Aa", this::shiftKey);
|
||||
keyBackspace = Controls.newTextButton("<<", () -> kbLabel.setText(removeLastChar(String.valueOf(kbLabel.getText()))));
|
||||
keySpace = Controls.newTextButton("SPACE", () -> kbLabel.setText(kbLabel.getText()+" "));
|
||||
keyOK = Controls.newTextButton("OK", () -> setKeyboardDialogText());
|
||||
keyAbort = Controls.newTextButton("Abort", () -> abortKeyInput());
|
||||
keyOK = Controls.newTextButton("OK", this::setKeyboardDialogText);
|
||||
keyAbort = Controls.newTextButton("Abort", this::abortKeyInput);
|
||||
this.getContentTable().add(kbLabel).width(220).height(20).colspan(10).expandX().align(Align.center);
|
||||
this.getButtonTable().row();
|
||||
this.getButtonTable().add(key1).width(20).height(20);
|
||||
|
||||
@@ -143,18 +143,14 @@ public class SimpleTiledModel extends Model {
|
||||
for (int t = 0; t < cardinality; t++) {
|
||||
ColorMap xtileData = tileData.get(tilename);
|
||||
this.tiles.add(
|
||||
tile.apply(
|
||||
(Integer x, Integer y) -> (xtileData.getColor(x, y))
|
||||
)
|
||||
tile.apply(xtileData::getColor)
|
||||
);
|
||||
this.tilenames.add(String.format("%s %s", tilename, t));
|
||||
}
|
||||
} else {
|
||||
ColorMap xtileData = tileData.get(tilename);
|
||||
this.tiles.add(
|
||||
tile.apply(
|
||||
(Integer x, Integer y) -> (xtileData.getColor(x, y))
|
||||
)
|
||||
tile.apply(xtileData::getColor)
|
||||
);
|
||||
|
||||
this.tilenames.add(String.format("%s 0", tilename));
|
||||
|
||||
@@ -57,7 +57,7 @@ public class LoadingOverlay extends FOverlay {
|
||||
loader.show();
|
||||
FThreads.invokeInBackgroundThread(() -> {
|
||||
task.run();
|
||||
FThreads.invokeInEdtLater(() -> loader.hide());
|
||||
FThreads.invokeInEdtLater(loader::hide);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ public class OnlineLobbyScreen extends LobbyScreen implements IOnlineLobby {
|
||||
}
|
||||
chatInterface.addMessage(result);
|
||||
if (!joinServer) {
|
||||
FThreads.invokeInBackgroundThread(() -> NetConnectUtil.copyHostedServerUrl());
|
||||
FThreads.invokeInBackgroundThread(NetConnectUtil::copyHostedServerUrl);
|
||||
}
|
||||
//update menu buttons
|
||||
OnlineScreen.Lobby.update();
|
||||
|
||||
@@ -37,7 +37,7 @@ public class NewConquestScreen extends MultiStepWizardScreen<NewConquestScreenMo
|
||||
@Override
|
||||
protected void finish() {
|
||||
//create new quest in game thread so option panes can wait for input
|
||||
ThreadUtil.invokeInGameThread(() -> newConquest());
|
||||
ThreadUtil.invokeInGameThread(this::newConquest);
|
||||
}
|
||||
|
||||
private void newConquest() {
|
||||
|
||||
@@ -181,7 +181,7 @@ public class NewQuestScreen extends FScreen {
|
||||
private final FLabel btnEmbark = add(new FLabel.ButtonBuilder()
|
||||
.font(FSkinFont.get(22)).text(Forge.getLocalizer().getMessage("lblEmbark")).icon(FSkinImage.QUEST_ZEP).command(event -> {
|
||||
//create new quest in game thread so option panes can wait for input
|
||||
ThreadUtil.invokeInGameThread(() -> newQuest());
|
||||
ThreadUtil.invokeInGameThread(this::newQuest);
|
||||
}).build());
|
||||
|
||||
public NewQuestScreen() {
|
||||
|
||||
@@ -24,7 +24,7 @@ public abstract class QuestLaunchScreen extends LaunchScreen {
|
||||
protected void startMatch() {
|
||||
FThreads.invokeInBackgroundThread(() -> {
|
||||
if (QuestUtil.canStartGame()) {
|
||||
FThreads.invokeInEdtLater(() -> LoadingOverlay.show(Forge.getLocalizer().getMessage("lblLoadingNewGame"), true, () -> QuestUtil.finishStartingGame()));
|
||||
FThreads.invokeInEdtLater(() -> LoadingOverlay.show(Forge.getLocalizer().getMessage("lblLoadingNewGame"), true, QuestUtil::finishStartingGame));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -51,14 +51,14 @@ public class QuestMenu extends FPopupMenu implements IVQuestStats {
|
||||
//invoke in background thread so prompts can work
|
||||
ThreadUtil.invokeInGameThread(() -> {
|
||||
QuestUtil.chooseAndUnlockEdition();
|
||||
FThreads.invokeInEdtLater(() -> updateCurrentQuestScreen());
|
||||
FThreads.invokeInEdtLater(QuestMenu::updateCurrentQuestScreen);
|
||||
});
|
||||
});
|
||||
private static final FMenuItem travelItem = new FMenuItem(Forge.getLocalizer().getMessage("btnTravel"), FSkinImage.QUEST_MAP, event -> {
|
||||
//invoke in background thread so prompts can work
|
||||
ThreadUtil.invokeInGameThread(() -> {
|
||||
QuestUtil.travelWorld();
|
||||
FThreads.invokeInEdtLater(() -> updateCurrentQuestScreen());
|
||||
FThreads.invokeInEdtLater(QuestMenu::updateCurrentQuestScreen);
|
||||
});
|
||||
});
|
||||
private static final FMenuItem prefsItem = new FMenuItem(Forge.getLocalizer().getMessage("Preferences"), Forge.hdbuttons ? FSkinImage.HDPREFERENCE : FSkinImage.SETTINGS, event -> setCurrentScreen(prefsScreen));
|
||||
|
||||
@@ -64,7 +64,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
|
||||
else {
|
||||
inventoryPage.activateItems(items);
|
||||
}
|
||||
FThreads.invokeInEdtLater(() -> updateCreditsLabel());
|
||||
FThreads.invokeInEdtLater(this::updateCreditsLabel);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -84,19 +84,19 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
|
||||
controller = new QuestTournamentController(this);
|
||||
btnSpendToken.setCommand(event -> {
|
||||
//must run in background thread to handle alerts
|
||||
FThreads.invokeInBackgroundThread(() -> controller.spendToken());
|
||||
FThreads.invokeInBackgroundThread(controller::spendToken);
|
||||
});
|
||||
btnEditDeck.setCommand(event -> editDeck(true));
|
||||
btnLeaveTournament.setCommand(event -> {
|
||||
//must run in background thread to handle alerts
|
||||
FThreads.invokeInBackgroundThread(() -> controller.endTournamentAndAwardPrizes());
|
||||
FThreads.invokeInBackgroundThread(controller::endTournamentAndAwardPrizes);
|
||||
});
|
||||
|
||||
// TODO: is it possible to somehow reuse the original btnEditDeck/btnLeaveTournament
|
||||
btnEditDeckInTourn.setCommand(event -> editDeck(true));
|
||||
btnLeaveTournamentInTourn.setCommand(event -> {
|
||||
//must run in background thread to handle alerts
|
||||
FThreads.invokeInBackgroundThread(() -> controller.endTournamentAndAwardPrizes());
|
||||
FThreads.invokeInBackgroundThread(controller::endTournamentAndAwardPrizes);
|
||||
});
|
||||
|
||||
pnlPrepareDeck.add(btnEditDeck);
|
||||
|
||||
@@ -35,8 +35,6 @@ public class DeckProxy implements InventoryItem {
|
||||
protected final String deckType;
|
||||
protected final IStorage<? extends IHasName> storage;
|
||||
|
||||
public static final Function<DeckProxy, String> FN_GET_NAME = arg0 -> arg0.getName();
|
||||
|
||||
// cached values
|
||||
protected ColorSet color;
|
||||
protected ColorSet colorIdentity;
|
||||
|
||||
@@ -2589,7 +2589,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
final Card card = gameCacheCounters.get(cv);
|
||||
|
||||
final ImmutableList<CounterType> counters = subtract ? ImmutableList.copyOf(card.getCounters().keySet())
|
||||
: ImmutableList.copyOf(Collections2.transform(CounterEnumType.values, input -> CounterType.get(input)));
|
||||
: ImmutableList.copyOf(Collections2.transform(CounterEnumType.values, CounterType::get));
|
||||
|
||||
final CounterType counter = getGui().oneOrNone(localizer.getMessage("lblWhichTypeofCounter"), counters);
|
||||
if (counter == null) {
|
||||
|
||||
@@ -45,7 +45,7 @@ class Documents {
|
||||
//System.out.println(docID);
|
||||
//System.out.println(bow.getWords(docID).toString());
|
||||
return bow.getWords(docID).stream()
|
||||
.map(id -> vocabs.get(id))
|
||||
.map(vocabs::get)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user