9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00

fix console on java 22+

This commit is contained in:
NONPLAYT
2025-03-10 01:04:38 +03:00
parent 1764ca9129
commit 4176f4dd61

View File

@@ -34,6 +34,22 @@ public class DivineBootstrap {
}
private static void runPreBootTasks() {
// not required rn
if (getJavaVersion() > 21) {
System.setProperty("jdk.console", "java.base");
}
}
private static int getJavaVersion() {
String version = System.getProperty("java.version");
if (version.startsWith("1.")) {
version = version.substring(2, 3);
} else {
int dot = version.indexOf(".");
if (dot != -1) {
version = version.substring(0, dot);
}
}
version = version.split("-")[0];
return Integer.parseInt(version);
}
}