Fix parsing Java version "17-ea"
This commit is contained in:
1 parent
15a6cf0acf
commit
cad4f47454
1 file changed
+6
-3
@@ -83,9 +83,12 @@ public final class Tools
|
||||
if (javaVersion.startsWith("1.")) {
|
||||
javaVersion = javaVersion.substring(2);
|
||||
}
|
||||
int dotIndex = javaVersion.indexOf('.');
|
||||
if (dotIndex != -1) {
|
||||
javaVersion = javaVersion.substring(0, dotIndex);
|
||||
int splitIndex = javaVersion.indexOf('.');
|
||||
if (splitIndex == -1) {
|
||||
splitIndex = javaVersion.indexOf('-');
|
||||
}
|
||||
if (splitIndex != -1) {
|
||||
javaVersion = javaVersion.substring(0, splitIndex);
|
||||
}
|
||||
if (versionInfo.javaVersion != null && versionInfo.javaVersion.majorVersion > Integer.parseInt(javaVersion)) {
|
||||
throw new UnsupportedOperationException("Minecraft " + versionInfo.id + " requires Java " + versionInfo.javaVersion.majorVersion + " in order to run. Please switch to Java " + versionInfo.javaVersion.majorVersion + " in launcher settings.");
|
||||
|
||||
Reference in new issue
Block a user