diff --git a/ParaUtil.Spigot/src/me/aa07/parautil/spigot/permissions/PermissionsManager.java b/ParaUtil.Spigot/src/me/aa07/parautil/spigot/permissions/PermissionsManager.java index 7d550c7..9a18118 100644 --- a/ParaUtil.Spigot/src/me/aa07/parautil/spigot/permissions/PermissionsManager.java +++ b/ParaUtil.Spigot/src/me/aa07/parautil/spigot/permissions/PermissionsManager.java @@ -20,6 +20,7 @@ public class PermissionsManager implements Listener { private PermissionsConfig config; private HashMap attachments; private HashSet admins; + private boolean enabled; public PermissionsManager(ParaUtilSpigot plugin, ConfigurationManager config) { this.plugin = plugin; @@ -32,22 +33,38 @@ public PermissionsManager(ParaUtilSpigot plugin, ConfigurationManager config) { // ADD ALL PERMISSIONS THIS PLUGIN USES Bukkit.getPluginManager().addPermission(new Permission("parautil.lookup")); - plugin.getLogger().info("[PermissionsManager] Loaded"); + if (Bukkit.getPluginManager().getPlugin("PermissionsEx") != null) { + enabled = false; + plugin.getLogger().info("[PermissionsManager] PermissionsEx detected. Events disabled."); + } else { + enabled = true; + plugin.getLogger().info("[PermissionsManager] Loaded"); + } + } // Called from LoginMananger public void grantAdminPermissions(Player player) { + if (!enabled) { + return; + } admins.add(player); } // Called from the reload command public void refreshAll() { + if (!enabled) { + return; + } for (Player player : Bukkit.getOnlinePlayers()) { refreshPermissions(player); } } public void refreshPermissions(Player player) { + if (!enabled) { + return; + } PermissionAttachment pa = attachments.get(player); // Remove all old for (String perm : pa.getPermissions().keySet()) { @@ -74,12 +91,18 @@ public void refreshPermissions(Player player) { } public void addAttachment(Player player) { + if (!enabled) { + return; + } PermissionAttachment pa = player.addAttachment(plugin); attachments.put(player, pa); } @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { + if (!enabled) { + return; + } attachments.remove(event.getPlayer()); }