mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
use server ip address as default
This commit is contained in:
parent
7aadc8ed9d
commit
681a030b8e
1 changed files with 12 additions and 1 deletions
|
@ -28,9 +28,11 @@
|
||||||
|
|
||||||
package mage.server;
|
package mage.server;
|
||||||
|
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import mage.server.util.PluginClassLoader;
|
import mage.server.util.PluginClassLoader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
|
import java.net.InetAddress;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import mage.game.GameType;
|
import mage.game.GameType;
|
||||||
|
@ -83,7 +85,16 @@ public class Main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Copier.setLoader(classLoader);
|
Copier.setLoader(classLoader);
|
||||||
System.setProperty("java.rmi.server.hostname", config.getServerAddress());
|
String ip = config.getServerAddress();
|
||||||
|
try {
|
||||||
|
if (ip.equals("localhost")) {
|
||||||
|
ip = InetAddress.getLocalHost().getHostAddress();
|
||||||
|
}
|
||||||
|
} catch (UnknownHostException ex) {
|
||||||
|
logger.log(Level.WARNING, "Could not get server address: ", ex);
|
||||||
|
}
|
||||||
|
System.setProperty("java.rmi.server.hostname", ip);
|
||||||
|
logger.info("MAGE server - using address " + ip);
|
||||||
server = new ServerImpl(config.getPort(), config.getServerName(), testMode);
|
server = new ServerImpl(config.getPort(), config.getServerName(), testMode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue