Skip to content

Commit

Permalink
Added server argument to configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Nov 11, 2017
1 parent 2c9ccb4 commit 21e6732
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
20 changes: 20 additions & 0 deletions launcher/src/main/java/com/skcraft/launcher/launch/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public Process call() throws Exception {
addLibraries();
addJarArgs();
addProxyArgs();
addServerArgs();
addWindowArgs();
addPlatformArgs();
addLegacyArgs();
Expand Down Expand Up @@ -305,6 +306,25 @@ private void addProxyArgs() {
}
}

/**
* 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.
*/
Expand Down

1 comment on commit 21e6732

@Velikss
Copy link

@Velikss Velikss commented on 21e6732 Feb 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would one use this?

Please sign in to comment.