diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index a23640ad6..95473720c 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -109,7 +109,7 @@ dependencies { implementation("com.palmergames.bukkit:towny:0.84.0.9") { isTransitive = false } implementation("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0") { isTransitive = false } implementation("com.comphenix.protocol:ProtocolLib:4.6.0") { isTransitive = false } - implementation("de.notmyfault:serverlib:1.0.1") + implementation("org.incendo.serverlib:ServerLib:2.0.0") } tasks.named("processResources") { @@ -155,8 +155,8 @@ tasks.named("shadowJar") { relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil") { include(dependency("it.unimi.dsi:fastutil")) } - relocate("de.notmyfault", "com.boydti.fawe") { - include(dependency("de.notmyfault:serverlib:1.0.1")) + relocate("org.incendo.serverlib", "com.boydti.fawe.serverlib") { + include(dependency("org.incendo.serverlib:ServerLib:2.0.0")) } relocate("com.intellectualsites.paster", "com.boydti.fawe.paster") { include(dependency("com.intellectualsites.paster:Paster:1.0.1-SNAPSHOT")) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/JavaVersionCheck.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/JavaVersionCheck.java deleted file mode 100644 index 1e8d5c62e..000000000 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/JavaVersionCheck.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.boydti.fawe.bukkit.util; - -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import org.apache.logging.log4j.Logger; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class JavaVersionCheck { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - - 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("************************************************************"); - } - } -} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 4bc7c9636..1fa754e1f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -50,7 +50,6 @@ import com.sk89q.worldedit.world.entity.EntityType; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemCategory; import com.sk89q.worldedit.world.weather.WeatherTypes; -import de.notmyfault.serverlib.ServerLib; import io.papermc.lib.PaperLib; import org.apache.logging.log4j.Logger; import org.bstats.bukkit.Metrics; @@ -69,6 +68,7 @@ import org.bukkit.event.world.WorldInitEvent; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.java.JavaPlugin; +import org.incendo.serverlib.ServerLib; import org.jetbrains.annotations.Nullable; import java.io.File; @@ -83,7 +83,6 @@ import java.util.List; import java.util.Locale; import java.util.Optional; -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; @@ -175,7 +174,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter new Metrics(this, 1403); // Check whether the server runs on 11 or greater - checkJvm(); + ServerLib.checkJavaLTS(); + ServerLib.checkJavaMinor(); // Check if we are in a safe environment ServerLib.checkUnsafeForks(); }