Add note about outdated java version

Dieser Commit ist enthalten in:
N0tMyFaultOG 2020-12-08 00:12:39 +01:00
Ursprung 55ba004c3f
Commit 3af1f45b4c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 823348042DA95A81
2 geänderte Dateien mit 57 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,53 @@
package com.boydti.fawe.bukkit.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class JavaVersionCheck {
public static final Logger logger = LoggerFactory.getLogger(JavaVersionCheck.class);
private static int checkJavaVersion() {
String javaVersion = System.getProperty("java.version");
final Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(javaVersion);
if (!matcher.find()) {
logger.warn("Failed to determine Java version; Could not parse: {}", javaVersion);
return -1;
}
final String version = matcher.group(1);
try {
return Integer.parseInt(version);
} catch (final NumberFormatException e) {
logger.warn("Failed to determine Java version; Could not parse {} from {}", version, javaVersion, e);
return -1;
}
}
public static void checkJvm() {
if (checkJavaVersion() < 11) {
logger.warn("************************************************************");
logger.warn("* WARNING - YOU ARE RUNNING AN OUTDATED VERSION OF JAVA.");
logger.warn("* FASTASYNCWORLDEDIT WILL STOP BEING COMPATIBLE WITH THIS VERSION OF");
logger.warn("* JAVA WHEN MINECRAFT 1.17 IS RELEASED.");
logger.warn("*");
logger.warn("* Please update the version of Java to 11. When Minecraft 1.17");
logger.warn("* is released, support for versions of Java prior to 11 will");
logger.warn("* be dropped.");
logger.warn("*");
logger.warn("* Current Java version: {}", System.getProperty("java.version"));
logger.warn("************************************************************");
}
if (checkJavaVersion() >= 15) {
logger.warn("************************************************************");
logger.warn("* FastAsyncWorldEdit uses Nashorn for the craftscript engine.");
logger.warn("* Within Java 15, Nashorn has been removed from Java.");
logger.warn("* Until we add a suitable workaround, you should stick to Java 11");
logger.warn("* to use all features of FastAsyncWorldEdit.");
logger.warn("************************************************************");
}
}
}

Datei anzeigen

@ -84,6 +84,7 @@ import java.util.Locale;
import java.util.Optional;
import java.util.logging.Level;
import static com.boydti.fawe.bukkit.util.JavaVersionCheck.checkJvm;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME;
@ -186,6 +187,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
// Setup metrics
new Metrics(this, BSTATS_PLUGIN_ID);
// Check whether the server runs on 11 or greater
checkJvm();
}
private void setupPreWorldData() {