diff --git a/pom.xml b/pom.xml index e7cf242..bd001cd 100644 --- a/pom.xml +++ b/pom.xml @@ -147,17 +147,13 @@ fr.xephi authme - 5.0-SNAPSHOT + 5.2-SNAPSHOT provided org.bukkit bukkit - - org.bukkit - craftbukkit - diff --git a/src/main/java/com/Acrobot/ChestShop/ChestShop.java b/src/main/java/com/Acrobot/ChestShop/ChestShop.java index cc787b3..3c060c9 100644 --- a/src/main/java/com/Acrobot/ChestShop/ChestShop.java +++ b/src/main/java/com/Acrobot/ChestShop/ChestShop.java @@ -213,7 +213,7 @@ public class ChestShop extends JavaPlugin { registerEvent(new ItemInfoListener()); registerEvent(new GarbageTextListener()); - if (this.getServer().getPluginManager().getPlugin("AuthMe") != null && this.getServer().getPluginManager().getPlugin("ChestShop").isEnabled()){ + if (this.getServer().getPluginManager().getPlugin("AuthMe") != null && this.getServer().getPluginManager().getPlugin("AuthMe").isEnabled()){ registerEvent(new AuthMeChestShopListener()); } diff --git a/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java b/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java index fd44ef3..03cfc2a 100644 --- a/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java +++ b/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java @@ -127,6 +127,13 @@ public class Properties { @ConfigurationComment("Do you want ChestShop to respect WorldGuard's chest protection?") public static boolean WORLDGUARD_USE_PROTECTION = false; + @PrecededBySpace + @ConfigurationComment("Do you want to deny shop access to unlogged users?") + public static boolean AUTHME_HOOK = true; + + @ConfigurationComment("Do you want to allow shop access to unregistered users? (Example: registration is optional)") + public static boolean AUTHME_ALLOW_UNREGISTERED = false; + @PrecededBySpace @ConfigurationComment("How much Heroes exp should people get for creating a ChestShop?") public static double HEROES_EXP = 100; diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/AuthMeChestShopListener.java b/src/main/java/com/Acrobot/ChestShop/Listeners/AuthMeChestShopListener.java index 1e61fa9..371840d 100644 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/AuthMeChestShopListener.java +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/AuthMeChestShopListener.java @@ -5,6 +5,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import com.Acrobot.ChestShop.Configuration.Properties; import com.Acrobot.ChestShop.Events.PreTransactionEvent; import com.Acrobot.ChestShop.Events.PreTransactionEvent.TransactionOutcome; @@ -19,13 +20,20 @@ public class AuthMeChestShopListener implements Listener { if (event.getClient() == null) { return; } - Player player = event.getClient(); + if (!Properties.AUTHME_HOOK) { + return; + } + if (AuthMeAPI.isUnrestricted(player)) { return; } + if (!AuthMeAPI.isRegistered(player.getName()) && Properties.AUTHME_ALLOW_UNREGISTERED) { + return; + } + if (AuthMeAPI.isAuthenticated(player)) { return; }