diff --git a/src/main/java/net/coreprotect/CoreProtect.java b/src/main/java/net/coreprotect/CoreProtect.java index 7530af1..9bc8a2f 100755 --- a/src/main/java/net/coreprotect/CoreProtect.java +++ b/src/main/java/net/coreprotect/CoreProtect.java @@ -137,8 +137,12 @@ public final class CoreProtect extends JavaPlugin { private static boolean performVersionChecks() { try { String[] bukkitVersion = Bukkit.getServer().getBukkitVersion().split("[-.]"); - if (Util.newVersion(bukkitVersion[0] + "." + bukkitVersion[1], ConfigHandler.SPIGOT_VERSION)) { - Chat.console(Phrase.build(Phrase.VERSION_REQUIRED, "Spigot", ConfigHandler.SPIGOT_VERSION)); + if (Util.newVersion(bukkitVersion[0] + "." + bukkitVersion[1], ConfigHandler.MINECRAFT_VERSION)) { + Chat.console(Phrase.build(Phrase.VERSION_REQUIRED, "Minecraft", ConfigHandler.MINECRAFT_VERSION)); + return false; + } + if (Util.newVersion(ConfigHandler.LATEST_VERSION, bukkitVersion[0] + "." + bukkitVersion[1]) && Util.isBranch("master")) { + Chat.console(Phrase.build(Phrase.VERSION_INCOMPATIBLE, "Minecraft", bukkitVersion[0] + "." + bukkitVersion[1])); return false; } String[] javaVersion = (System.getProperty("java.version").replaceAll("[^0-9.]", "") + ".0").split("\\."); diff --git a/src/main/java/net/coreprotect/command/PurgeCommand.java b/src/main/java/net/coreprotect/command/PurgeCommand.java index e6f2dd2..73f4897 100755 --- a/src/main/java/net/coreprotect/command/PurgeCommand.java +++ b/src/main/java/net/coreprotect/command/PurgeCommand.java @@ -104,6 +104,11 @@ public class PurgeCommand extends Consumer { int restrictCount = 0; if (argBlocks.size() > 0) { + if (!Util.validDonationKey()) { + Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DONATION_KEY_REQUIRED)); + return; + } + StringBuilder includeListMaterial = new StringBuilder(); StringBuilder includeListEntity = new StringBuilder(); diff --git a/src/main/java/net/coreprotect/config/ConfigHandler.java b/src/main/java/net/coreprotect/config/ConfigHandler.java index ab13b92..50a4ec1 100644 --- a/src/main/java/net/coreprotect/config/ConfigHandler.java +++ b/src/main/java/net/coreprotect/config/ConfigHandler.java @@ -45,7 +45,8 @@ public class ConfigHandler extends Queue { public static final String EDITION_NAME = Util.getPluginName(); public static final String COMMUNITY_EDITION = "Community Edition"; public static final String JAVA_VERSION = "11.0"; - public static final String SPIGOT_VERSION = "1.15"; + public static final String MINECRAFT_VERSION = "1.15"; + public static final String LATEST_VERSION = "1.21"; public static String path = "plugins/CoreProtect/"; public static String sqlite = "database.db"; public static String host = "127.0.0.1"; diff --git a/src/main/java/net/coreprotect/language/Language.java b/src/main/java/net/coreprotect/language/Language.java index a19004d..91f703b 100644 --- a/src/main/java/net/coreprotect/language/Language.java +++ b/src/main/java/net/coreprotect/language/Language.java @@ -55,6 +55,7 @@ public class Language { phrases.put(Phrase.DEVELOPMENT_BRANCH, "Development branch detected, skipping patch scripts."); phrases.put(Phrase.DIRT_BLOCK, "Placed a temporary safety block under you."); phrases.put(Phrase.DISABLE_SUCCESS, "Success! Disabled {0}"); + phrases.put(Phrase.DONATION_KEY_REQUIRED, "A valid donation key is required for that command."); phrases.put(Phrase.ENABLE_FAILED, "{0} was unable to start."); phrases.put(Phrase.ENABLE_SUCCESS, "{0} has been successfully enabled!"); phrases.put(Phrase.ENJOY_COREPROTECT, "Enjoy {0}? Join our Discord!"); @@ -232,6 +233,7 @@ public class Language { phrases.put(Phrase.USING_SQLITE, "Using SQLite for data storage."); phrases.put(Phrase.VALID_DONATION_KEY, "Valid donation key."); phrases.put(Phrase.VERSION_NOTICE, "Version {0} is now available."); + phrases.put(Phrase.VERSION_INCOMPATIBLE, "{0} {1} is not supported."); phrases.put(Phrase.VERSION_REQUIRED, "{0} {1} or higher is required."); phrases.put(Phrase.WORLD_NOT_FOUND, "World \"{0}\" not found."); diff --git a/src/main/java/net/coreprotect/language/Phrase.java b/src/main/java/net/coreprotect/language/Phrase.java index 89e487f..d99c4c3 100644 --- a/src/main/java/net/coreprotect/language/Phrase.java +++ b/src/main/java/net/coreprotect/language/Phrase.java @@ -38,6 +38,7 @@ public enum Phrase { DEVELOPMENT_BRANCH, DIRT_BLOCK, DISABLE_SUCCESS, + DONATION_KEY_REQUIRED, ENABLE_FAILED, ENABLE_SUCCESS, ENJOY_COREPROTECT, @@ -215,6 +216,7 @@ public enum Phrase { USING_SQLITE, VALID_DONATION_KEY, VERSION_NOTICE, + VERSION_INCOMPATIBLE, VERSION_REQUIRED, WORLD_NOT_FOUND;