-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add -server launcher argument #10914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This patch adds -server argument for auto connecting to server on startup Example usage: java -jar desktop.jar -server localhost This can be useful in game launchers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although this would be a good feature, i just see a lot of flaws in this implementation...
I doubt Anuke would merge this PR in the state it is in right now.
@@ -44,7 +45,7 @@ public static void main(String[] arg){ | |||
width = 900; | |||
height = 700; | |||
gl30Minor = 2; | |||
gl30 = true; | |||
gl30 = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why put a trailing whitespace there?
@@ -72,14 +73,24 @@ public static void main(String[] arg){ | |||
handleCrash(e); | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No point in removing that whitespace...?
|
||
Events.on(ClientLoadEvent.class, event -> { | ||
// Now (if -server option is present) we inject server to serverlist and automaticly connect to it. | ||
if (Seq.with(args).contains("-server")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use serverAddr (init it to null) instead of that?
Log.info("Autoconnecting to server " + serverAddr); | ||
int port = Vars.port; // TODO: Use port specified in Vars. | ||
if (serverAddr.contains(":")) { | ||
port = Strings.parseInt(serverAddr.substring(serverAddr.indexOf(":")+1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this WILL break with ipv6 addresses.
This patch adds -server argument for auto connecting to server on startup
Example usage: java -jar desktop.jar -server localhost
This can be useful in game launchers(example: some server with mods that has launcher to automatically downloads new version of mindustry(if avaible) and mods, and starts desktop.jar with -server arg).
(i used vscodium btw)
If your pull request is not translation or serverlist-related, read the list of requirements below and check each box: