diff --git a/launcher/src/main/java/com/skcraft/launcher/Configuration.java b/launcher/src/main/java/com/skcraft/launcher/Configuration.java index 28ea11650..d1e063896 100644 --- a/launcher/src/main/java/com/skcraft/launcher/Configuration.java +++ b/launcher/src/main/java/com/skcraft/launcher/Configuration.java @@ -35,6 +35,9 @@ public class Configuration { private String proxyUsername; private String proxyPassword; private String gameKey; + private boolean serverEnabled = false; + private String serverHost; + private int serverPort = 25565; @Override public boolean equals(Object o) { diff --git a/launcher/src/main/java/com/skcraft/launcher/launch/Runner.java b/launcher/src/main/java/com/skcraft/launcher/launch/Runner.java index 10d70fe55..833d73316 100644 --- a/launcher/src/main/java/com/skcraft/launcher/launch/Runner.java +++ b/launcher/src/main/java/com/skcraft/launcher/launch/Runner.java @@ -136,6 +136,7 @@ public Process call() throws Exception { addLibraries(); addJarArgs(); addProxyArgs(); + addServerArgs(); addWindowArgs(); addPlatformArgs(); addLegacyArgs(); @@ -305,6 +306,25 @@ private void addProxyArgs() { } } + /** + * Add server arguments. + */ + private void addServerArgs() { + List args = builder.getArgs(); + + if (config.isServerEnabled()) { + String host = config.getServerHost(); + int port = config.getServerPort(); + + if (!Strings.isNullOrEmpty(host) && port > 0 && port < 65535) { + args.add("--server"); + args.add(host); + args.add("--port"); + args.add(String.valueOf(port)); + } + } + } + /** * Add window arguments. */