From 4e6aee6bfb6e4b1abe11355bc024f3cc74327acd Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 25 Oct 2021 14:12:21 +0100 Subject: [PATCH] Don't consider global region for blacklisting WG regions --- .../bukkit/regions/WorldGuardFeature.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java index f4d55f834..c89840407 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java @@ -88,13 +88,13 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener { LOGGER.info("Region capability is not enabled for that world."); return Collections.emptySet(); } - final ProtectedRegion global = manager.getRegion("__global__"); - // If they're allowed and it's a whitelist return, else if they're not allowed and it's a blacklist, return - if (global != null && isAllowed(player, global) == isWhitelist) { - return Collections.singleton(global); - } //Merge WorldGuardFlag if (isWhitelist) { + // Only consider global when whitelisting + final ProtectedRegion global = manager.getRegion("__global__"); + if (global != null && isAllowed(player, global)) { + return Collections.singleton(global); + } final ApplicableRegionSet regions = manager.getApplicableRegions(BlockVector3.at( location.getX(), location.getY(), @@ -119,6 +119,9 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener { final Collection regions = manager.getRegions().values(); Set protectedRegions = new HashSet<>(); for (ProtectedRegion region : regions) { + if (region.getId().equals("__global__")) { + continue; + } if (!isAllowed(player, region)) { protectedRegions.add(region); }