mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Check for outdated Java versions older than 16
This commit is contained in:
parent
070ff46558
commit
f16f91f469
2 changed files with 32 additions and 1 deletions
|
@ -379,9 +379,40 @@ public class GeyserConnector {
|
||||||
logger.warning(LanguageUtils.getLocaleStringLog("geyser.core.movement_warn"));
|
logger.warning(LanguageUtils.getLocaleStringLog("geyser.core.movement_warn"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkForOutdatedJava();
|
||||||
|
|
||||||
newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED);
|
newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkForOutdatedJava() {
|
||||||
|
final int supportedJavaVersion = 16;
|
||||||
|
// Taken from Paper
|
||||||
|
String javaVersion = System.getProperty("java.version");
|
||||||
|
Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(javaVersion);
|
||||||
|
if (!matcher.find()) {
|
||||||
|
getLogger().debug("Could not parse Java version string " + javaVersion);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String version = matcher.group(1);
|
||||||
|
int majorVersion;
|
||||||
|
try {
|
||||||
|
majorVersion = Integer.parseInt(version);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
getLogger().debug("Could not format as an int: " + version);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (majorVersion < supportedJavaVersion) {
|
||||||
|
getLogger().warning("*********************************************");
|
||||||
|
getLogger().warning("");
|
||||||
|
getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.bootstrap.unsupported_java.header"));
|
||||||
|
getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.bootstrap.unsupported_java.message", supportedJavaVersion, javaVersion));
|
||||||
|
getLogger().warning("");
|
||||||
|
getLogger().warning("*********************************************");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown"));
|
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown"));
|
||||||
shuttingDown = true;
|
shuttingDown = true;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c8923b1f71c7f66621729be47dec7f911606c6a1
|
Subproject commit d0cbd4b616be6c057115fdb13d75866b8452893e
|
Loading…
Reference in a new issue