diff --git a/Mage.Server/build.xml b/Mage.Server/build.xml index 117a511a53..322d2e7a37 100644 --- a/Mage.Server/build.xml +++ b/Mage.Server/build.xml @@ -10,6 +10,7 @@ Builds, tests, and runs the project Mage.Server. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - - - - - - java -cp "${run.classpath.with.dist.jar}" ${main.class} - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mage.Server/nbproject/genfiles.properties b/Mage.Server/nbproject/genfiles.properties deleted file mode 100644 index d86aa6ce1a..0000000000 --- a/Mage.Server/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=0771c912 -build.xml.script.CRC32=7fe29de1 -build.xml.stylesheet.CRC32=958a1d3e@1.26.2.45 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=6d7d5003 -nbproject/build-impl.xml.script.CRC32=ba175561 -nbproject/build-impl.xml.stylesheet.CRC32=5c621a33@1.26.2.45 diff --git a/Mage.Server/nbproject/project.properties b/Mage.Server/nbproject/project.properties index 02a2f7f2fb..c0fae92fc5 100644 --- a/Mage.Server/nbproject/project.properties +++ b/Mage.Server/nbproject/project.properties @@ -26,9 +26,7 @@ jar.compress=false javac.classpath=\ ${reference.Mage.jar}:\ ${reference.Mage_Common.jar}:\ - ${reference.Mage_Sets.jar}:\ - ${reference.Mage_Player_AI.jar}:\ - ${reference.Mage_Player_Human.jar} + ${reference.Mage_Sets.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false @@ -50,7 +48,7 @@ javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= -jaxbwiz.endorsed.dirs=${netbeans.home}/../ide9/modules/ext/jaxb/api +jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api" jaxbwiz.gensrc.classpath=${libs.jaxb.classpath} jaxbwiz.xjcdef.classpath=${libs.jaxb.classpath} jaxbwiz.xjcrun.classpath=${libs.jaxb.classpath} @@ -61,13 +59,9 @@ platform.active=default_platform project.license=bsd project.Mage=../Mage project.Mage_Common=../Mage.Common -project.Mage_Player_AI=../Mage.Player.AI -project.Mage_Player_Human=../Mage.Player.Human project.Mage_Sets=../Mage.Sets reference.Mage.jar=${project.Mage}/dist/Mage.jar reference.Mage_Common.jar=${project.Mage_Common}/dist/Mage.Common.jar -reference.Mage_Player_AI.jar=${project.Mage_Player_AI}/dist/Mage.Player.AI.jar -reference.Mage_Player_Human.jar=${project.Mage_Player_Human}/dist/Mage.Player.Human.jar reference.Mage_Sets.jar=${project.Mage_Sets}/dist/Mage.Sets.jar run-sys-prop.java.endorsed.dirs=${jaxbwiz.endorsed.dirs} run.classpath=\ diff --git a/Mage.Server/nbproject/project.xml b/Mage.Server/nbproject/project.xml index 0dc292d1b2..820483a2e4 100644 --- a/Mage.Server/nbproject/project.xml +++ b/Mage.Server/nbproject/project.xml @@ -33,22 +33,6 @@ clean jar - - Mage_Player_AI - jar - - jar - clean - jar - - - Mage_Player_Human - jar - - jar - clean - jar - Mage_Sets jar diff --git a/Mage.Server/plugins/Mage.AI.jar b/Mage.Server/plugins/Mage.AI.jar deleted file mode 100644 index 37fa8d3e69..0000000000 Binary files a/Mage.Server/plugins/Mage.AI.jar and /dev/null differ diff --git a/Mage.Server/plugins/Mage.HumanPlayer.jar b/Mage.Server/plugins/Mage.HumanPlayer.jar deleted file mode 100644 index 52da76d553..0000000000 Binary files a/Mage.Server/plugins/Mage.HumanPlayer.jar and /dev/null differ diff --git a/Mage.Server/release/config/logging.config b/Mage.Server/release/config/logging.config deleted file mode 100644 index 19c8f182de..0000000000 --- a/Mage.Server/release/config/logging.config +++ /dev/null @@ -1,2 +0,0 @@ -# Default global logging level. -.level=INFO \ No newline at end of file diff --git a/Mage.Server/src/mage/server/Main.java b/Mage.Server/src/mage/server/Main.java index 6647332009..6de1e956ed 100644 --- a/Mage.Server/src/mage/server/Main.java +++ b/Mage.Server/src/mage/server/Main.java @@ -30,6 +30,7 @@ package mage.server; import mage.server.util.PluginClassLoader; import java.io.File; +import java.io.FilenameFilter; import java.util.logging.Level; import java.util.logging.Logger; import mage.server.game.DeckValidatorFactory; @@ -61,6 +62,7 @@ public class Main { logger.info("Starting MAGE server version " + Main.class.getPackage().getImplementationVersion()); logger.info("Logging level: " + Logging.getLevel(logger)); + deleteSavedGames(); ConfigSettings config = ConfigSettings.getInstance(); for (Plugin plugin: config.getGameTypes()) { GameFactory.getInstance().addGameType(plugin.getName(), loadPlugin(plugin)); @@ -96,4 +98,20 @@ public class Main { return null; } + private static void deleteSavedGames() { + File directory = new File("saved/"); + File[] files = directory.listFiles( + new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.endsWith(".game"); + } + } + ); + for (File file : files) + { + file.delete(); + } + } + } diff --git a/Mage.Server/src/mage/server/game/PlayerFactory.java b/Mage.Server/src/mage/server/game/PlayerFactory.java index 80013e808c..8c21882dbb 100644 --- a/Mage.Server/src/mage/server/game/PlayerFactory.java +++ b/Mage.Server/src/mage/server/game/PlayerFactory.java @@ -34,6 +34,7 @@ import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; +import mage.cards.decks.Deck; import mage.players.Player; import mage.util.Logging; @@ -54,12 +55,12 @@ public class PlayerFactory { private PlayerFactory() {} - public Player createPlayer(String playerType, String name) { + public Player createPlayer(String playerType, String name, Deck deck) { Player player; Constructor con; try { - con = playerTypes.get(playerType).getConstructor(new Class[]{String.class}); - player = (Player)con.newInstance(new Object[] {name}); + con = playerTypes.get(playerType).getConstructor(new Class[]{String.class, Deck.class}); + player = (Player)con.newInstance(new Object[] {name, deck}); } catch (Exception ex) { logger.log(Level.SEVERE, null, ex); return null; diff --git a/Mage.Server/src/mage/server/game/TableController.java b/Mage.Server/src/mage/server/game/TableController.java index 79bc2c6553..dafec435a2 100644 --- a/Mage.Server/src/mage/server/game/TableController.java +++ b/Mage.Server/src/mage/server/game/TableController.java @@ -134,9 +134,9 @@ public class TableController { } private Player createPlayer(String name, Deck deck, String playerType) { - Player player = PlayerFactory.getInstance().createPlayer(playerType, name); + Player player = PlayerFactory.getInstance().createPlayer(playerType, name, deck); logger.info("Player created " + player.getId()); - player.setDeck(deck); +// player.setDeck(deck); return player; } @@ -178,8 +178,8 @@ public class TableController { } finally { output.close(); - logger.log(Level.SEVERE, "Saved game:" + game.getId()); } + logger.log(Level.SEVERE, "Saved game:" + game.getId()); } catch(IOException ex) { logger.log(Level.SEVERE, "Cannot save game.", ex);