From 72f0f65beda46144dc15f6353dad5f0c7912a7dc Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 1 Aug 2015 01:05:05 +0200 Subject: [PATCH] added perworlditems check --- src/main/java/fr/xephi/authme/AuthMe.java | 32 ++++++++++++++++--- .../authme/listener/AuthMeServerListener.java | 4 +-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 98f335d4b..7ed3dd9f4 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -187,14 +187,17 @@ public class AuthMe extends JavaPlugin { mail = new SendMailSSL(this); // Check Citizens Version - citizensVersion(); + checkCitizens(); // Check Combat Tag Version - combatTag(); + checkCombatTag(); // Check Multiverse checkMultiverse(); + // Check PerWorldInventories Version + checkPerWorldInventories(); + // Check ChestShop checkChestShop(); @@ -354,6 +357,27 @@ public class AuthMe extends JavaPlugin { } } + public void checkPerWorldInventories() { + if (this.getServer().getPluginManager().getPlugin("PerWorldInventories") != null && this.getServer().getPluginManager().getPlugin("PerWorldInventories").isEnabled()) { + try { + String ver = Bukkit.getServer().getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion(); + try { + double version = Double.valueOf(ver.split(" ")[0]); + if (version < 1.57) + ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); + } catch (NumberFormatException nfe) { + try { + double version = Double.valueOf(ver.split("t")[0]); + if (version < 1.57) + ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!"); + } catch (NumberFormatException nfee) { + } + } + } catch (Exception e) { + } + } + } + public void checkMultiverse() { if (!Settings.multiverse) { multiverse = null; @@ -403,7 +427,7 @@ public class AuthMe extends JavaPlugin { } } - public void combatTag() { + public void checkCombatTag() { if (this.getServer().getPluginManager().getPlugin("CombatTag") != null && this.getServer().getPluginManager().getPlugin("CombatTag").isEnabled()) { this.CombatTag = true; } else { @@ -411,7 +435,7 @@ public class AuthMe extends JavaPlugin { } } - public void citizensVersion() { + public void checkCitizens() { if (this.getServer().getPluginManager().getPlugin("Citizens") != null && this.getServer().getPluginManager().getPlugin("Citizens").isEnabled()) this.isCitizensActive = true; else this.isCitizensActive = false; diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index f05710e7e..4f0b2ed50 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -84,9 +84,9 @@ public class AuthMeServerListener implements Listener { if (pluginName.equalsIgnoreCase("ChestShop")) plugin.checkChestShop(); if (pluginName.equalsIgnoreCase("CombatTag")) - plugin.combatTag(); + plugin.checkCombatTag(); if (pluginName.equalsIgnoreCase("Citizens")) - plugin.citizensVersion(); + plugin.checkCitizens(); if (pluginName.equalsIgnoreCase("Vault")) plugin.checkVault(); }