From e91fc8f15af2da855aad881369b26f3bb7ecbc1f Mon Sep 17 00:00:00 2001 From: Trent Hensler Date: Mon, 5 Feb 2018 21:34:55 -0700 Subject: [PATCH] Don't set perms to undefined by default --- .../factions/zcore/persist/MemoryFaction.java | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java index 17fe61c3..8754d2bb 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java @@ -332,7 +332,8 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { Map accessMap = permissions.get(permissable); if (accessMap != null && accessMap.containsKey(permissableAction)) { - return accessMap.get(permissableAction); + Access access = accessMap.get(permissableAction); + return access != null ? access : Access.UNDEFINED; } return Access.UNDEFINED; @@ -377,26 +378,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { public void resetPerms() { P.p.log(Level.WARNING, "Resetting permissions for Faction: " + tag); - permissions.clear(); - - // First populate a map with undefined as the permission for each action. - Map freshMap = new HashMap<>(); - for (PermissableAction permissableAction : PermissableAction.values()) { - freshMap.put(permissableAction, Access.UNDEFINED); - } - - // Put the map in there for each relation. - for (Relation relation : Relation.values()) { - permissions.put(relation, freshMap); - } - - // And each role. - for (Role role : Role.values()) { - if (role != Role.ADMIN) { - permissions.put(role, freshMap); - } - } } /**