Fixes a NumberFormatException when running custom versions without a version number
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good
This commit is contained in:
parent
365d08f2e2
commit
9532683301
@ -345,6 +345,7 @@ public class Server {
|
||||
return false;
|
||||
}
|
||||
if (ServerHandler.stoppingServers()) {
|
||||
gui.logMessage("Stopping servers. Cannot start yet.");
|
||||
return false;
|
||||
}
|
||||
//Starts the server if possible
|
||||
@ -367,14 +368,17 @@ public class Server {
|
||||
*/
|
||||
private String getJavaCommand() {
|
||||
ServerLauncherController controller = ServerLauncherController.getInstance();
|
||||
|
||||
if (serverVersion.toLowerCase().contains("latest")) {
|
||||
return controller.getJavaCommand();
|
||||
} else if (serverVersion.contains(".") && serverVersion.split("\\.").length >= 2 &&
|
||||
Integer.parseInt(serverVersion.split("\\.")[1]) >= 17) {
|
||||
return controller.getJavaCommand();
|
||||
} else {
|
||||
return controller.getOldJavaCommand();
|
||||
} else if (serverVersion.contains(".") && serverVersion.split("\\.").length >= 2) {
|
||||
try {
|
||||
if (Integer.parseInt(serverVersion.split("\\.")[1]) >= 17) {
|
||||
return controller.getJavaCommand();
|
||||
}
|
||||
} catch (NumberFormatException ignored) {}
|
||||
}
|
||||
return controller.getOldJavaCommand();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user