update missing migration

This commit is contained in:
kevlahnota
2025-08-26 07:16:43 +08:00
committed by GitHub
parent 9325794e2f
commit f452b94cb8
4 changed files with 29 additions and 35 deletions

View File

@@ -112,7 +112,7 @@ public class FDeckChooser extends FScreen {
deckChooser.optionPane = new FOptionPane(null, null, title, null, container, ImmutableList.of(Forge.getLocalizer().getInstance().getMessage("lblOK"), Forge.getLocalizer().getInstance().getMessage("lblCancel")), 0, result -> { deckChooser.optionPane = new FOptionPane(null, null, title, null, container, ImmutableList.of(Forge.getLocalizer().getInstance().getMessage("lblOK"), Forge.getLocalizer().getInstance().getMessage("lblCancel")), 0, result -> {
if (result == 0) { if (result == 0) {
if (callback != null) { if (callback != null) {
callback.run(deckChooser.getDeck()); callback.accept(deckChooser.getDeck());
} }
} }
}) { }) {

View File

@@ -561,25 +561,22 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
if (editorConfig.getGameType() != null && editorConfig.hasInfiniteCardPool()) { if (editorConfig.getGameType() != null && editorConfig.hasInfiniteCardPool()) {
addItem(new FMenuItem(localizer.getMessage("lblImportFromClipboard"), Forge.hdbuttons ? FSkinImage.HDIMPORT : FSkinImage.OPEN, e -> { addItem(new FMenuItem(localizer.getMessage("lblImportFromClipboard"), Forge.hdbuttons ? FSkinImage.HDIMPORT : FSkinImage.OPEN, e -> {
FDeckImportDialog dialog = new FDeckImportDialog(!deck.isEmpty(), FDeckEditor.this.editorConfig); FDeckImportDialog dialog = new FDeckImportDialog(!deck.isEmpty(), FDeckEditor.this.editorConfig);
dialog.setCallback(new Callback<>() { dialog.setCallback(importedDeck -> {
@Override if (deck != null && importedDeck.hasName()) {
public void run(Deck importedDeck) { deck.setName(importedDeck.getName());
if (deck != null && importedDeck.hasName()) { setHeaderText(importedDeck.getName());
deck.setName(importedDeck.getName()); }
setHeaderText(importedDeck.getName()); if (dialog.createNewDeck()) {
for (Entry<DeckSection, CardPool> section : importedDeck) {
DeckSectionPage page = getPageForSection(section.getKey());
if (page != null)
page.setCards(section.getValue());
} }
if (dialog.createNewDeck()) { } else {
for (Entry<DeckSection, CardPool> section : importedDeck) { for (Entry<DeckSection, CardPool> section : importedDeck) {
DeckSectionPage page = getPageForSection(section.getKey()); DeckSectionPage page = getPageForSection(section.getKey());
if (page != null) if (page != null)
page.setCards(section.getValue()); page.addCards(section.getValue());
}
} else {
for (Entry<DeckSection, CardPool> section : importedDeck) {
DeckSectionPage page = getPageForSection(section.getKey());
if (page != null)
page.addCards(section.getValue());
}
} }
} }
}); });
@@ -1828,16 +1825,13 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
sortedOptions.add(option); sortedOptions.add(option);
} }
} }
GuiChoose.oneOrNone(Forge.getLocalizer().getMessage("lblSelectPreferredArt") + " " + card.getName(), sortedOptions, new Callback<>() { GuiChoose.oneOrNone(Forge.getLocalizer().getMessage("lblSelectPreferredArt") + " " + card.getName(), sortedOptions, result -> {
@Override if (result != null) {
public void run(PaperCard result) { if (result != card) {
if (result != null) { cardManager.replaceAll(card, result);
if (result != card) {
cardManager.replaceAll(card, result);
}
prefs.setPreferredArt(result.getEdition(), result.getArtIndex());
CardPreferences.save();
} }
prefs.setPreferredArt(result.getEdition(), result.getArtIndex());
CardPreferences.save();
} }
}); });
})); }));

View File

@@ -52,7 +52,7 @@ public class GuiDownloader extends FDialog {
service.setCancel(true); service.setCancel(true);
hide(); hide();
if (callback != null) { if (callback != null) {
callback.run(getButton(0).getText() == "OK"); //determine result based on whether download finished callback.accept(getButton(0).getText() == "OK"); //determine result based on whether download finished
} }
} }
}; };

View File

@@ -77,8 +77,8 @@ public class FFileChooser extends FDialog {
refreshFileList(); refreshFileList();
return; return;
} }
} catch (Exception e) { } catch (Exception e1) {
e.printStackTrace(); e1.printStackTrace();
} }
FOptionPane.showErrorDialog(Forge.getLocalizer().getMessage("lblEnterFolderNameNotValid", result), Forge.getLocalizer().getMessage("lblInvalidName")); FOptionPane.showErrorDialog(Forge.getLocalizer().getMessage("lblEnterFolderNameNotValid", result), Forge.getLocalizer().getMessage("lblInvalidName"));
}); });
@@ -229,8 +229,8 @@ public class FFileChooser extends FDialog {
return; return;
} }
} }
catch (Exception e) { catch (Exception e2) {
e.printStackTrace(); e2.printStackTrace();
} }
FOptionPane.showErrorDialog(Forge.getLocalizer().getMessage("lblEnterNameNotValid", result), Forge.getLocalizer().getMessage("lblInvalidName")); FOptionPane.showErrorDialog(Forge.getLocalizer().getMessage("lblEnterNameNotValid", result), Forge.getLocalizer().getMessage("lblInvalidName"));
}); });
@@ -259,8 +259,8 @@ public class FFileChooser extends FDialog {
return; return;
} }
} }
catch (Exception ex) { catch (Exception e3) {
ex.printStackTrace(); e3.printStackTrace();
} }
FOptionPane.showErrorDialog(Forge.getLocalizer().getMessage("lblCouldBotDeleteFile")); FOptionPane.showErrorDialog(Forge.getLocalizer().getMessage("lblCouldBotDeleteFile"));
} }