From 48c43c5abbe6b7e76d278b451b7757c80a7f916a Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Sun, 27 Nov 2011 10:06:23 -0600 Subject: [PATCH] Delay asking for PermissionHandler - might help PEX not freak out --- .../java/org/dynmap/permissions/NijikokunPermissions.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/dynmap/permissions/NijikokunPermissions.java b/src/main/java/org/dynmap/permissions/NijikokunPermissions.java index dade7c82..bf6ded94 100644 --- a/src/main/java/org/dynmap/permissions/NijikokunPermissions.java +++ b/src/main/java/org/dynmap/permissions/NijikokunPermissions.java @@ -12,11 +12,13 @@ import com.nijikokun.bukkit.Permissions.Permissions; public class NijikokunPermissions implements PermissionProvider { String name; PermissionHandler permissions; - + Plugin plugin; + public static NijikokunPermissions create(Server server, String name) { Plugin permissionsPlugin = server.getPluginManager().getPlugin("Permissions"); if (permissionsPlugin == null) return null; + server.getPluginManager().enablePlugin(permissionsPlugin); Log.info("Using Permissions " + permissionsPlugin.getDescription().getVersion() + " for access control"); return new NijikokunPermissions(permissionsPlugin, name); @@ -24,11 +26,13 @@ public class NijikokunPermissions implements PermissionProvider { public NijikokunPermissions(Plugin permissionsPlugin, String name) { this.name = name; - permissions = ((Permissions) permissionsPlugin).getHandler(); + plugin = permissionsPlugin; } @Override public boolean has(CommandSender sender, String permission) { + if(permissions == null) + permissions = ((Permissions)plugin).getHandler(); Player player = sender instanceof Player ? (Player) sender : null; return player != null ? permissions.has(player, name + "." + permission) || permissions.has(player, name + ".*")