mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Adding in Jumpstart Custom (requested fixes)
This commit is contained in:
parent
1e428105d5
commit
b64806606c
2 changed files with 30 additions and 17 deletions
|
|
@ -785,19 +785,21 @@ public class NewTournamentDialog extends MageDialog {
|
|||
return "";
|
||||
}
|
||||
|
||||
private JFileChooser fcJumpstartSelectDeck = null;
|
||||
|
||||
protected String playerLoadJumpstartPacks() {
|
||||
if (fcSelectDeck == null) {
|
||||
fcSelectDeck = new JFileChooser();
|
||||
fcSelectDeck.setAcceptAllFileFilterUsed(false);
|
||||
fcSelectDeck.addChoosableFileFilter(new DeckFileFilter("txt", "Jumpstart Packs (*.txt)"));
|
||||
if (fcJumpstartSelectDeck == null) {
|
||||
fcJumpstartSelectDeck = new JFileChooser();
|
||||
fcJumpstartSelectDeck.setAcceptAllFileFilterUsed(false);
|
||||
fcJumpstartSelectDeck.addChoosableFileFilter(new DeckFileFilter("txt", "Jumpstart Packs (*.txt)"));
|
||||
}
|
||||
String lastFolder = MageFrame.getPreferences().get("lastDeckFolder", "");
|
||||
if (!lastFolder.isEmpty()) {
|
||||
fcSelectDeck.setCurrentDirectory(new File(lastFolder));
|
||||
fcJumpstartSelectDeck.setCurrentDirectory(new File(lastFolder));
|
||||
}
|
||||
int ret = fcSelectDeck.showDialog(this, "Select Jumpstart Packs file");
|
||||
int ret = fcJumpstartSelectDeck.showDialog(this, "Select Jumpstart Packs file");
|
||||
if (ret == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fcSelectDeck.getSelectedFile();
|
||||
File file = fcJumpstartSelectDeck.getSelectedFile();
|
||||
return (file.getPath());
|
||||
}
|
||||
return "";
|
||||
|
|
@ -1234,6 +1236,10 @@ public class NewTournamentDialog extends MageDialog {
|
|||
String jumpstartPacksData = "";
|
||||
try {
|
||||
jumpstartPacksData = new String(Files.readAllBytes(Paths.get(jumpstartPacksFilename)));
|
||||
if (jumpstartPacksData.length() > 300000) {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Chosen file too big", "Jumpstart Packs data is too long. Please trim or choose another file.", JOptionPane.ERROR_MESSAGE);
|
||||
jumpstartPacksData = "";
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), e2.getMessage(), "Error loading Jumpstart Packs data", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue