From 7507a9771268e7f574a0dc20e19f6f708de2d40e Mon Sep 17 00:00:00 2001 From: BetaSteward Date: Fri, 10 Dec 2010 10:49:56 -0500 Subject: [PATCH] check for server property --- Mage.Server/src/main/java/mage/server/Main.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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());