From 2f5cb9f167d9e906f42c4fa49c8590b64ee8fc00 Mon Sep 17 00:00:00 2001 From: Zartec Date: Mon, 23 May 2016 21:10:30 +0200 Subject: [PATCH] Fixed custom flags. Cache maps must check against IFlag to allow custom flags. --- .../foxguard/plugin/handler/GlobalHandler.java | 6 +++--- .../foxguard/plugin/handler/GroupHandler.java | 12 ++++++------ .../plugin/handler/PassiveHandler.java | 6 +++--- .../foxguard/plugin/handler/SimpleHandler.java | 18 +++++++++--------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GlobalHandler.java b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GlobalHandler.java index e686c2a..c44725c 100644 --- a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GlobalHandler.java +++ b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GlobalHandler.java @@ -70,9 +70,9 @@ public GlobalHandler() { super(NAME, Integer.MIN_VALUE / 2); this.map = new CacheMap<>((key, map) -> Tristate.UNDEFINED); this.mapCache = new CacheMap<>((o, m) -> { - if (o instanceof Flag) { - Tristate state = map.get(FGUtil.nearestParent((Flag) o, map.keySet())); - m.put((Flag) o, state); + if (o instanceof IFlag) { + Tristate state = map.get(FGUtil.nearestParent((IFlag) o, map.keySet())); + m.put((IFlag) o, state); return state; } else return Tristate.UNDEFINED; }); diff --git a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GroupHandler.java b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GroupHandler.java index 901c502..9b2787e 100644 --- a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GroupHandler.java +++ b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GroupHandler.java @@ -81,16 +81,16 @@ public GroupHandler(String name, int priority, this.defaultPermissions = defaultPermissions; this.groupPermCache = new CacheMap<>((o, m) -> { - if (o instanceof Flag) { - Tristate state = groupPermissions.get(FGUtil.nearestParent((Flag) o, groupPermissions.keySet())); - m.put((Flag) o, state); + if (o instanceof IFlag) { + Tristate state = groupPermissions.get(FGUtil.nearestParent((IFlag) o, groupPermissions.keySet())); + m.put((IFlag) o, state); return state; } else return Tristate.UNDEFINED; }); this.defaultPermCache = new CacheMap<>((o, m) -> { - if (o instanceof Flag) { - Tristate state = defaultPermissions.get(FGUtil.nearestParent((Flag) o, defaultPermissions.keySet())); - m.put((Flag) o, state); + if (o instanceof IFlag) { + Tristate state = defaultPermissions.get(FGUtil.nearestParent((IFlag) o, defaultPermissions.keySet())); + m.put((IFlag) o, state); return state; } else return Tristate.UNDEFINED; }); diff --git a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/PassiveHandler.java b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/PassiveHandler.java index a5932de..1b66102 100644 --- a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/PassiveHandler.java +++ b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/PassiveHandler.java @@ -71,9 +71,9 @@ public PassiveHandler(String name, int priority, CacheMap map) super(name, priority); this.map = map; this.mapCache = new CacheMap<>((o, m) -> { - if (o instanceof Flag) { - Tristate state = map.get(FGUtil.nearestParent((Flag) o, map.keySet())); - m.put((Flag) o, state); + if (o instanceof IFlag) { + Tristate state = map.get(FGUtil.nearestParent((IFlag) o, map.keySet())); + m.put((IFlag) o, state); return state; } else return Tristate.UNDEFINED; }); diff --git a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/SimpleHandler.java b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/SimpleHandler.java index e2d2e5d..84370e3 100644 --- a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/SimpleHandler.java +++ b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/SimpleHandler.java @@ -97,23 +97,23 @@ public SimpleHandler(String name, int priority, this.defaultPermissions = defaultPermissions; this.ownerPermCache = new CacheMap<>((o, m) -> { - if (o instanceof Flag) { - Tristate state = ownerPermissions.get(FGUtil.nearestParent((Flag) o, ownerPermissions.keySet())); - m.put((Flag) o, state); + if (o instanceof IFlag) { + Tristate state = ownerPermissions.get(FGUtil.nearestParent((IFlag) o, ownerPermissions.keySet())); + m.put((IFlag) o, state); return state; } else return Tristate.UNDEFINED; }); this.memberPermCache = new CacheMap<>((o, m) -> { - if (o instanceof Flag) { - Tristate state = memberPermissions.get(FGUtil.nearestParent((Flag) o, memberPermissions.keySet())); - m.put((Flag) o, state); + if (o instanceof IFlag) { + Tristate state = memberPermissions.get(FGUtil.nearestParent((IFlag) o, memberPermissions.keySet())); + m.put((IFlag) o, state); return state; } else return Tristate.UNDEFINED; }); this.defaultPermCache = new CacheMap<>((o, m) -> { - if (o instanceof Flag) { - Tristate state = defaultPermissions.get(FGUtil.nearestParent((Flag) o, defaultPermissions.keySet())); - m.put((Flag) o, state); + if (o instanceof IFlag) { + Tristate state = defaultPermissions.get(FGUtil.nearestParent((IFlag) o, defaultPermissions.keySet())); + m.put((IFlag) o, state); return state; } else return Tristate.UNDEFINED; });