diff --git a/Mage.Server/src/main/java/mage/server/Main.java b/Mage.Server/src/main/java/mage/server/Main.java index d7e9f2d0da..05ee15e2a1 100644 --- a/Mage.Server/src/main/java/mage/server/Main.java +++ b/Mage.Server/src/main/java/mage/server/Main.java @@ -85,7 +85,12 @@ public class Main { } } Copier.setLoader(classLoader); - String ip = config.getServerAddress(); + setServerAddress(config.getServerAddress()); + server = new ServerImpl(config.getPort(), config.getServerName(), testMode); + + } + + private static void setServerAddress(String ip) { try { if (ip.equals("localhost")) { ip = InetAddress.getLocalHost().getHostAddress(); @@ -93,12 +98,14 @@ public class Main { } catch (UnknownHostException ex) { logger.log(Level.WARNING, "Could not get server address: ", ex); } + String ipParam = System.getProperty("server"); + if (ipParam != null) { + ip = ipParam; + } System.setProperty("java.rmi.server.hostname", ip); logger.info("MAGE server - using address " + ip); - server = new ServerImpl(config.getPort(), config.getServerName(), testMode); - - } - + } + private static Class loadPlugin(Plugin plugin) { try { classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL());