From 46359cfbfea9ba0a9bee0cba7ba5baffa19e3467 Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Sat, 12 Mar 2016 15:51:16 -0700 Subject: [PATCH] Fixes #1678 anchor list doesn't obey enforceaccess --- .../MultiverseCore/utils/AnchorManager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/AnchorManager.java b/src/main/java/com/onarandombox/MultiverseCore/utils/AnchorManager.java index e7b904f9..6a874f1e 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/AnchorManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/AnchorManager.java @@ -140,8 +140,17 @@ public class AnchorManager { if (ancLoc == null) { continue; } - if (p.hasPermission("multiverse.access." + ancLoc.getWorld().getName())) { + String worldPerm = "multiverse.access." + ancLoc.getWorld().getName(); + // Add to the list if we're not enforcing access + // OR + // We are enforcing access and the user has the permission. + if (!this.plugin.getMVConfig().getEnforceAccess() || + (this.plugin.getMVConfig().getEnforceAccess() && p.hasPermission(worldPerm))) { myAnchors.add(anchor); + } else { + Logging.finer(String.format("Not adding anchor %s to the list, user %s doesn't have the %s " + + "permission and 'enforceaccess' is enabled!", + anchor, p.getName(), worldPerm)); } } return Collections.unmodifiableSet(myAnchors);