From 4fe9c6bd7433117c9cade8be73925a404d7ba15b Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 21 Jun 2024 08:49:09 +0200 Subject: [PATCH] fix: correctly process chunks when using worldguard region blacklists (#2789) - fixes #2399 --- .../fastasyncworldedit/bukkit/regions/WorldGuardFeature.java | 4 ++++ .../src/main/java/com/sk89q/worldedit/regions/Region.java | 2 +- .../java/com/sk89q/worldedit/regions/RegionIntersection.java | 2 +- 3 files changed, 6 insertions(+), 2 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 c847a8688..6a055de05 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 @@ -1,5 +1,6 @@ package com.fastasyncworldedit.bukkit.regions; +import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.regions.FaweMask; import com.fastasyncworldedit.core.regions.RegionWrapper; import com.sk89q.worldedit.bukkit.BukkitAdapter; @@ -158,6 +159,9 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener { @Override public FaweMask getMask(com.sk89q.worldedit.entity.Player wePlayer, MaskType type, boolean isWhitelist) { + if (isWhitelist && Settings.settings().REGION_RESTRICTIONS_OPTIONS.WORLDGUARD_REGION_BLACKLIST) { + return new FaweMask(RegionWrapper.GLOBAL()); + } final Player player = BukkitAdapter.adapt(wePlayer); final LocalPlayer localplayer = this.worldguard.wrapPlayer(player); final Location location = player.getLocation(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java index 08f2ee00c..085274772 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java @@ -482,7 +482,7 @@ public interface Region extends Iterable, Cloneable, IBatchProcess } return set; } else { - return null; + return set; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java index c1a81834c..4312e50fa 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java @@ -205,7 +205,7 @@ public class RegionIntersection extends AbstractRegion { BlockVector3 regMin = region.getMinimumPoint(); BlockVector3 regMax = region.getMaximumPoint(); if (tx >= regMin.x() && bx <= regMax.x() && tz >= regMin.z() && bz <= regMax.z()) { - return region.processSet(chunk, get, set, true); + set = region.processSet(chunk, get, set, true); } } return set; // default return set as no "blacklist" regions contained the chunk