Speed up permission recalculation.

Based on ideas in PR #102, but rewritten for correctness.

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2015-09-18 10:33:56 +10:00
parent 441f6fa9c2
commit ef91dacfe8
2 changed files with 2 additions and 1 deletions

View file

@ -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;

View file

@ -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);