From 46e8a37cf09fdbb3c0a9b87b598f3f8578bf6d4b Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 4 Jun 2023 23:57:51 +0100 Subject: [PATCH] fix: improve test for polygonal region containment of cuboid - Possibly fixes #2265 --- .../worldedit/regions/Polygonal2DRegion.java | 32 ++++++++++--------- .../com/sk89q/worldedit/regions/Region.java | 2 -- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java index e02e72029..021e042be 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java @@ -506,24 +506,26 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { //FAWE start @Override public boolean containsEntireCuboid(int bx, int tx, int by, int ty, int bz, int tz) { - for (int x = bx; x <= tx; x++) { - if (!contains(x, 0, bz)) { - return false; + for (int y : new int[]{by, ty}) { + for (int x = bx; x <= tx; x++) { + if (!contains(x, y, bz)) { + return false; + } } - } - for (int x = bx; x <= tx; x++) { - if (!contains(x, 0, tz)) { - return false; + for (int x = bx; x <= tx; x++) { + if (!contains(x, y, tz)) { + return false; + } } - } - for (int z = bz; z <= tz; z++) { - if (!contains(bx, 0, z)) { - return false; + for (int z = bz; z <= tz; z++) { + if (!contains(bx, y, z)) { + return false; + } } - } - for (int z = bz; z <= tz; z++) { - if (!contains(tx, 0, z)) { - return false; + for (int z = bz; z <= tz; z++) { + if (!contains(tx, y, z)) { + return false; + } } } return true; 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 8d718fb05..c18650560 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 @@ -42,8 +42,6 @@ import com.sk89q.worldedit.world.World; import javax.annotation.Nullable; import java.util.List; import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Future; /** * Represents a physical shape.