diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index 4ca074d59f..d850cb210e 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -71,8 +71,8 @@ public class NewTournamentDialog extends MageDialog { private UUID playerId; private UUID roomId; private Session session; - private List players = new ArrayList(); - private List packs = new ArrayList(); + private final List players = new ArrayList<>(); + private final List packs = new ArrayList<>(); /** Creates new form NewTournamentDialog */ public NewTournamentDialog() { @@ -710,16 +710,19 @@ public class NewTournamentDialog extends MageDialog { PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_TYPE, tOptions.getTournamentType()); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_FREE_MULLIGANS, Integer.toString(tOptions.getMatchOptions().getFreeMulligans())); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_WINS, Integer.toString(tOptions.getMatchOptions().getWinsNeeded())); - if (tOptions.getTournamentType().equals("Sealed Elimination")) { - PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_SEALED, tOptions.getLimitedOptions().getSetCodes().toString()); - PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_SEALED, Integer.toString(tOptions.getPlayerTypes().size())); - } else if (tOptions.getTournamentType().equals("Elimination Booster Draft")) { - DraftOptions draftOptions = (DraftOptions) tOptions.getLimitedOptions(); - if (draftOptions != null) { - PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_DRAFT, draftOptions.getSetCodes().toString()); - PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT, Integer.toString(tOptions.getPlayerTypes().size())); - PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_DRAFT_TIMING, draftOptions.getTiming().name()); - } + switch (tOptions.getTournamentType()) { + case "Sealed Elimination": + PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_SEALED, tOptions.getLimitedOptions().getSetCodes().toString()); + PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_SEALED, Integer.toString(tOptions.getPlayerTypes().size())); + break; + case "Elimination Booster Draft": + DraftOptions draftOptions = (DraftOptions) tOptions.getLimitedOptions(); + if (draftOptions != null) { + PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_DRAFT, draftOptions.getSetCodes().toString()); + PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT, Integer.toString(tOptions.getPlayerTypes().size())); + PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_DRAFT_TIMING, draftOptions.getTiming().name()); + } + break; } PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS, (tOptions.isWatchingAllowed()?"Yes":"No")); diff --git a/Mage.Client/src/main/java/mage/client/game/BattlefieldPanel.java b/Mage.Client/src/main/java/mage/client/game/BattlefieldPanel.java index 51479ec846..a30538a033 100644 --- a/Mage.Client/src/main/java/mage/client/game/BattlefieldPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/BattlefieldPanel.java @@ -56,8 +56,8 @@ import mage.cards.MagePermanent; import mage.client.cards.BigCard; import mage.client.cards.Permanent; import mage.client.plugins.impl.Plugins; -import mage.client.util.audio.AudioManager; import mage.client.util.Config; +import mage.client.util.audio.AudioManager; import mage.constants.CardType; import mage.view.PermanentView; diff --git a/Mage.Common/src/mage/interfaces/ServerState.java b/Mage.Common/src/mage/interfaces/ServerState.java index da013de981..899a38f875 100644 --- a/Mage.Common/src/mage/interfaces/ServerState.java +++ b/Mage.Common/src/mage/interfaces/ServerState.java @@ -40,13 +40,13 @@ import mage.view.TournamentTypeView; */ public class ServerState implements Serializable { - private List gameTypes; - private List tournamentTypes; - private String[] playerTypes; - private String[] deckTypes; - private String[] draftCubes; - private boolean testMode; - private MageVersion version; + private final List gameTypes; + private final List tournamentTypes; + private final String[] playerTypes; + private final String[] deckTypes; + private final String[] draftCubes; + private final boolean testMode; + private final MageVersion version; public ServerState(List gameTypes, List tournamentTypes, String[] playerTypes, String[] deckTypes, String[] draftCubes, boolean testMode, MageVersion version) { this.gameTypes = gameTypes; diff --git a/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java b/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java index fa32f32437..b943506e9e 100644 --- a/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java +++ b/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java @@ -50,9 +50,9 @@ public class TournamentFactory { private static final TournamentFactory INSTANCE = new TournamentFactory(); private static final Logger logger = Logger.getLogger(TournamentFactory.class); - private Map> tournaments = new HashMap>(); - private Map tournamentTypes = new HashMap(); - private List tournamentTypeViews = new ArrayList(); + private final Map> tournaments = new HashMap<>(); + private final Map tournamentTypes = new HashMap<>(); + private final List tournamentTypeViews = new ArrayList<>(); public static TournamentFactory getInstance() { return INSTANCE; @@ -69,7 +69,7 @@ public class TournamentFactory { tournament = con.newInstance(new Object[] {options}); // transfer set information, create short info string for included sets tournament.setTournamentType(tournamentTypes.get(tournamentType)); - Map setInfo = new LinkedHashMap(); + Map setInfo = new LinkedHashMap<>(); for (String setCode: options.getLimitedOptions().getSetCodes()) { tournament.getSets().add(Sets.findSet(setCode)); int count = setInfo.containsKey(setCode) ? setInfo.get(setCode) : 0; diff --git a/Mage.Updater/src/main/java/com/magefree/update/Updater.java b/Mage.Updater/src/main/java/com/magefree/update/Updater.java index 56829eaa70..ed39bc80b9 100644 --- a/Mage.Updater/src/main/java/com/magefree/update/Updater.java +++ b/Mage.Updater/src/main/java/com/magefree/update/Updater.java @@ -65,7 +65,7 @@ public class Updater { * @throws Exception */ public HashMap readLocalData() throws Exception { - HashMap result = new HashMap(); + HashMap result = new HashMap<>(); for (File f : findFiles()) { result.put(f.getPath().replaceAll("\\\\", "/"), ChechsumHelper.getSHA1Checksum(f.getPath())); } @@ -79,7 +79,7 @@ public class Updater { * @throws Exception */ public List findFiles() throws Exception { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); result.addAll(FileHelper.findAllFilesInDir("mage-client/lib")); result.addAll(FileHelper.findAllFilesInDir("mage-client/plugins")); result.addAll(FileHelper.findAllFilesInDir("mage-server/lib")); @@ -95,7 +95,7 @@ public class Updater { * @throws Exception */ public HashMap downloadAndParseUpdateData() throws Exception { - HashMap result = new HashMap(); + HashMap result = new HashMap<>(); URL url = new URL(URL_PREFIX + "update-data.txt"); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); @@ -104,7 +104,7 @@ public class Updater { String[] lines = scanner.nextLine().split(" "); if (lines.length == 2) { result.put(lines[1], lines[0]); - //System.out.println("jar " + lines[1] + ", checksum " + lines[0]); + System.out.println("jar " + lines[1] + ", checksum " + lines[0]); } } return result; @@ -120,7 +120,7 @@ public class Updater { * @return List of files to be replaced with newer versions. */ public List findUpdated(HashMap local, HashMap remote) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); for (String remoteFile : remote.keySet()) { if (local.containsKey(remoteFile)) { if (!local.get(remoteFile).equals(remote.get(remoteFile))) { @@ -133,7 +133,7 @@ public class Updater { } public List findNew(HashMap local, HashMap remote) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); for (String remoteFile : remote.keySet()) { if (!local.containsKey(remoteFile)) { //System.out.println("new jar found - " + remoteFile); @@ -152,7 +152,7 @@ public class Updater { * @return List of files to be removed. */ public List findRemoved(HashMap local, HashMap remote) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); for (String localFile : local.keySet()) { if (!remote.containsKey(localFile)) { //System.out.println("deleted jar found - " + localFile); diff --git a/readme.md b/readme.md index a795bd2d45..1b8fe6e454 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # MAGE - Magic, Another Game Engine -MAGE allows you to play magic against one or more online players or computer opponents. It includes full rules enforcement for **7210** unique cards (12178 in all). Starting with Eventide, all regular sets have all the cards implemented ([status in detail](http://ct-magefree.rhcloud.com/stats)). +MAGE allows you to play magic against one or more online players or computer opponents. It includes full rules enforcement for **7,750** unique cards (13,100 in all). Starting with Eventide, all regular sets have nearly all the cards implemented ([status in detail](http://ct-magefree.rhcloud.com/stats)). There is at least one public server where you can play MAGE against other players. Apart from this, you can also host your own server to play against the AI and/or your friends. @@ -17,9 +17,9 @@ You can visit the official MAGE forum [here](http://www.slightlymagic.net/forum/ ## Installation Download the latest release from [here](http://download.magefree.com). You need this to be able to play on the official server. -After you extract the contents of the arhive, you will find batch files to start the client/server in the corresponding directories. See the included readme files for more instructions. +After you extract the content of the archive, you will find batch files to start the client/server in the corresponding directories. See the included readme files for more instructions. -You will need to have the [Java Runtime Environment](http://java.com/en/) Version 6 Update 24 or greater. +You will need to have the [Java Runtime Environment](http://java.com/en/) Version 7. Here you can find a log of the latest changes: [Release changes] (http://github.com/magefree/mage/wiki/Release-changes)