From 5de4cfced2b24e223a833035454b38d72039a3c0 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 13 Sep 2016 09:26:23 +0200 Subject: [PATCH 1/3] Fix region contain method The region contain method was broken. A lot of subsquent issues are caused by this bug. E.g. in a selection the entities in the last blocks at the positive-axis border are not selected. Max block gives the impression of an exclusive point; however it is inclusive! A position that is anywhere between of a 1x1x1 region, would return false in the old implementation. By simply adding a one this should solve the problem. Greetings --- .../main/java/com/sk89q/worldedit/regions/CuboidRegion.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index 258be2c6f..cf0a93503 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -336,9 +336,9 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { Vector min = getMinimumPoint(); Vector max = getMaximumPoint(); - return x >= min.getBlockX() && x <= max.getBlockX() - && y >= min.getBlockY() && y <= max.getBlockY() - && z >= min.getBlockZ() && z <= max.getBlockZ(); + return x >= min.getBlockX() && x < max.getBlockX() + 1 + && y >= min.getBlockY() && y < max.getBlockY() + 1 + && z >= min.getBlockZ() && z < max.getBlockZ() + 1; } @Override From 6c65a8a98997fb5dc464914646e8fafc58dd0f15 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 13 Sep 2016 23:13:47 +0200 Subject: [PATCH 2/3] CuboidRegion contains use block position Int casting would be better here than adding one to the max block --- .../com/sk89q/worldedit/regions/CuboidRegion.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index cf0a93503..b61651aba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -329,16 +329,16 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public boolean contains(Vector position) { - double x = position.getX(); - double y = position.getY(); - double z = position.getZ(); + int x = position.getBlockX(); + int y = position.getBlockY(); + int z = position.getBlockZ(); Vector min = getMinimumPoint(); Vector max = getMaximumPoint(); - return x >= min.getBlockX() && x < max.getBlockX() + 1 - && y >= min.getBlockY() && y < max.getBlockY() + 1 - && z >= min.getBlockZ() && z < max.getBlockZ() + 1; + return x >= min.getBlockX() && x <= max.getBlockX() + && y >= min.getBlockY() && y <= max.getBlockY() + && z >= min.getBlockZ() && z <= max.getBlockZ(); } @Override From 01e082a1a4c2d300b1d5f7210f6efc6b86c3d759 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 2 Sep 2017 18:09:53 +1000 Subject: [PATCH 3/3] Fix FallbackRegistrationListener --- .../com/sk89q/bukkit/util/FallbackRegistrationListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/FallbackRegistrationListener.java b/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/FallbackRegistrationListener.java index 73ee10759..035318341 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/FallbackRegistrationListener.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/FallbackRegistrationListener.java @@ -34,7 +34,7 @@ public class FallbackRegistrationListener implements Listener { @EventHandler(ignoreCancelled = true) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { - if (commandRegistration.dispatch(event.getPlayer(), event.getMessage())) { + if (commandRegistration.dispatch(event.getPlayer(), event.getMessage().substring(1))) { event.setCancelled(true); } }