1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2025-01-07 19:29:03 +01:00

Added server argument to configuration

This commit is contained in:
Matthew Miller 2017-11-11 15:42:16 +10:00
parent 2c9ccb4338
commit 21e67328c7
2 changed files with 23 additions and 0 deletions

View File

@ -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) {

View File

@ -136,6 +136,7 @@ public class Runner implements Callable<Process>, ProgressObservable {
addLibraries();
addJarArgs();
addProxyArgs();
addServerArgs();
addWindowArgs();
addPlatformArgs();
addLegacyArgs();
@ -305,6 +306,25 @@ public class Runner implements Callable<Process>, ProgressObservable {
}
}
/**
* Add server arguments.
*/
private void addServerArgs() {
List<String> 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.
*/