diff options
author | md_5 <git@md-5.net> | 2015-09-18 10:33:56 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2015-09-18 10:33:56 +1000 |
commit | 5c985d814b5eb048ac1bad08ef85f3a2ea412f80 (patch) | |
tree | 01108190fea67754b7eddc3475ef7fddf0046ebc | |
parent | 4791913b5b9edf87c09e5eef8ed4ab79eb8d1136 (diff) | |
download | bukkit-5c985d814b5eb048ac1bad08ef85f3a2ea412f80.tar bukkit-5c985d814b5eb048ac1bad08ef85f3a2ea412f80.tar.gz bukkit-5c985d814b5eb048ac1bad08ef85f3a2ea412f80.tar.lz bukkit-5c985d814b5eb048ac1bad08ef85f3a2ea412f80.tar.xz bukkit-5c985d814b5eb048ac1bad08ef85f3a2ea412f80.zip |
Speed up permission recalculation.
Based on ideas in PR #102, but rewritten for correctness.
-rw-r--r-- | src/main/java/org/bukkit/permissions/Permission.java | 1 | ||||
-rw-r--r-- | src/main/java/org/bukkit/plugin/SimplePluginManager.java | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/permissions/Permission.java b/src/main/java/org/bukkit/permissions/Permission.java index 14ec7099..0184f47c 100644 --- a/src/main/java/org/bukkit/permissions/Permission.java +++ b/src/main/java/org/bukkit/permissions/Permission.java @@ -52,6 +52,7 @@ public class Permission { } public Permission(String name, String description, PermissionDefault defaultValue, Map<String, Boolean> children) { + Validate.notNull(name, "Name cannot be null"); this.name = name; this.description = (description == null) ? "" : description; diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java index e51658df..5a9e50db 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -615,7 +615,7 @@ public final class SimplePluginManager implements PluginManager { } public void recalculatePermissionDefaults(Permission perm) { - if (permissions.containsValue(perm)) { + if (perm != null && permissions.containsKey(perm.getName().toLowerCase())) { defaultPerms.get(true).remove(perm); defaultPerms.get(false).remove(perm); |