This commit is contained in:
Brianna O'Keefe 2018-11-23 15:04:34 -05:00
parent d6185e3183
commit 0942ef4dd8

View File

@ -34,12 +34,14 @@ public final class UltimateRepairing extends JavaPlugin implements Listener {
private CommandManager commandManager; private CommandManager commandManager;
private boolean checkVersion() { private boolean checkVersion() {
int maxVersion = 12; // also supports 1.8 and higher int workingVersion = 13;
int currentVersion = Integer.parseInt(Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3].split("_")[1]); int currentVersion = Integer.parseInt(Bukkit.getServer().getClass()
if (currentVersion > maxVersion) { .getPackage().getName().split("\\.")[3].split("_")[1]);
if (currentVersion < workingVersion) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> { Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> {
Bukkit.getConsoleSender().sendMessage(""); Bukkit.getConsoleSender().sendMessage("");
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "You installed the legacy (1.8 - 1.12) only version of " + this.getDescription().getName() + " on a 1." + currentVersion + " server. Since you are on the wrong version we disabled the plugin for you. Please install correct version to continue using " + this.getDescription().getName() + "."); Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "You installed the 1." + workingVersion + "+ only version of " + this.getDescription().getName() + " on a 1." + currentVersion + " server. Since you are on the wrong version we disabled the plugin for you. Please install correct version to continue using " + this.getDescription().getName() + ".");
Bukkit.getConsoleSender().sendMessage(""); Bukkit.getConsoleSender().sendMessage("");
}, 20L); }, 20L);
return false; return false;