mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 19:25:15 +01:00
Delay asking for PermissionHandler - might help PEX not freak out
This commit is contained in:
parent
97f5d0c715
commit
48c43c5abb
@ -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 + ".*")
|
||||
|
Loading…
Reference in New Issue
Block a user