mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-24 12:16:36 +01:00
Only start CoreProtect on supported Minecraft versions
This commit is contained in:
parent
c493a0dece
commit
ea1b86c034
@ -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("\\.");
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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.");
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user