From d42854845acf4c658ac8104cc26df0afe8e4db5a Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 27 Jul 2023 10:02:41 +0100 Subject: [PATCH] fix: disallowed regions can be length 0 (#2368) --- .../com/sk89q/worldedit/EditSessionBuilder.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java index e5c53a45b..ca6f3b6a5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java @@ -607,20 +607,17 @@ public final class EditSessionBuilder { } FaweRegionExtent regionExtent = null; - if (disallowedRegions != null) { // Always use MultiRegionExtent if we have blacklist regions + // Always use MultiRegionExtent if we have blacklist regions + if (allowedRegions != null && allowedRegions.length == 0) { + regionExtent = new NullExtent(this.extent, FaweCache.NO_REGION); + } else if (disallowedRegions != null && disallowedRegions.length != 0) { regionExtent = new MultiRegionExtent(this.extent, this.limit, allowedRegions, disallowedRegions); } else if (allowedRegions == null) { allowedRegions = new Region[]{RegionWrapper.GLOBAL()}; + } else if (allowedRegions.length == 1) { + regionExtent = new SingleRegionExtent(this.extent, this.limit, allowedRegions[0]); } else { - if (allowedRegions.length == 0) { - regionExtent = new NullExtent(this.extent, FaweCache.NO_REGION); - } else { - if (allowedRegions.length == 1) { - regionExtent = new SingleRegionExtent(this.extent, this.limit, allowedRegions[0]); - } else { - regionExtent = new MultiRegionExtent(this.extent, this.limit, allowedRegions, null); - } - } + regionExtent = new MultiRegionExtent(this.extent, this.limit, allowedRegions, null); } if (regionExtent != null) { if (placeChunks) {