From 67f9e54285bd1fc024e46671f164dba6a65bc775 Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Thu, 21 Jan 2021 10:19:07 +0100 Subject: [PATCH] Enhance reload message --- .../fawe/bukkit/util/SaneSoftwareCheck.java | 18 ++++++++++++++++++ .../worldedit/bukkit/WorldEditPlugin.java | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/SaneSoftwareCheck.java diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/SaneSoftwareCheck.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/SaneSoftwareCheck.java new file mode 100644 index 000000000..570332118 --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/util/SaneSoftwareCheck.java @@ -0,0 +1,18 @@ +package com.boydti.fawe.bukkit.util; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SaneSoftwareCheck { + + private static final Logger log = LoggerFactory.getLogger(SaneSoftwareCheck.class); + + public static Class checkVersion() { + try { + Class.forName("org.yatopiamc.yatopia.server.YatopiaConfig"); + } catch (ClassNotFoundException e) { + return null; + } log.warn("You are running a server fork that is known to be extremely dangerous and lead to data loss. It is strongly recommended you switch to a more stable, high-performing server software, like Paper."); + return null; + } +} 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 500d3796e..78b9a3221 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 @@ -84,6 +84,7 @@ import java.util.Optional; import java.util.logging.Level; import static com.boydti.fawe.bukkit.util.JavaVersionCheck.checkJvm; +import static com.boydti.fawe.bukkit.util.SaneSoftwareCheck.checkVersion; import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME; @@ -162,7 +163,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter // register this so we can load world-dependent data right as the first world is loading getServer().getPluginManager().registerEvents(new WorldInitListener(), this); } else { - getLogger().warning("Server reload detected. This may cause various issues with WorldEdit and dependent plugins."); + getLogger().warning("Server reload detected. This may cause various issues with FastAsyncWorldEdit and dependent plugins."); + getLogger().warning("For more information, see https://matthewmiller.dev/blog/problem-with-reload/"); try { setupPreWorldData(); // since worlds are loaded already, we can do this now @@ -176,6 +178,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter // Check whether the server runs on 11 or greater checkJvm(); + // Check if we are in a safe environment + checkVersion(); } private void setupPreWorldData() {