From c1eecefa6f4ae1ba896d4c953aa6c49a3baa247b Mon Sep 17 00:00:00 2001 From: Intelli Date: Tue, 21 Dec 2021 15:31:08 -0700 Subject: [PATCH] Fixed radius selections not supporting negative heights --- src/main/java/net/coreprotect/CoreProtectAPI.java | 2 +- .../net/coreprotect/command/CommandHandler.java | 12 ++++++------ .../command/RollbackRestoreCommand.java | 2 +- src/main/java/net/coreprotect/database/Lookup.java | 14 +++++++------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/coreprotect/CoreProtectAPI.java b/src/main/java/net/coreprotect/CoreProtectAPI.java index 7e6bcd8..70744e8 100755 --- a/src/main/java/net/coreprotect/CoreProtectAPI.java +++ b/src/main/java/net/coreprotect/CoreProtectAPI.java @@ -464,7 +464,7 @@ public class CoreProtectAPI extends Queue { int xMax = location.getBlockX() + radius; int zMin = location.getBlockZ() - radius; int zMax = location.getBlockZ() + radius; - argRadius = new Integer[] { radius, xMin, xMax, -1, -1, zMin, zMax, 0 }; + argRadius = new Integer[] { radius, xMin, xMax, null, null, zMin, zMax, 0 }; } if (lookup == 1) { diff --git a/src/main/java/net/coreprotect/command/CommandHandler.java b/src/main/java/net/coreprotect/command/CommandHandler.java index 6c54a18..e2e8622 100755 --- a/src/main/java/net/coreprotect/command/CommandHandler.java +++ b/src/main/java/net/coreprotect/command/CommandHandler.java @@ -563,12 +563,12 @@ public class CommandHandler implements CommandExecutor { rcount++; } if (location != null) { - int xmin = location.getBlockX() - r_x; - int xmax = location.getBlockX() + r_x; - int ymin = -1; - int ymax = -1; - int zmin = location.getBlockZ() - r_z; - int zmax = location.getBlockZ() + r_z; + Integer xmin = location.getBlockX() - r_x; + Integer xmax = location.getBlockX() + r_x; + Integer ymin = null; + Integer ymax = null; + Integer zmin = location.getBlockZ() - r_z; + Integer zmax = location.getBlockZ() + r_z; if (r_y > -1) { ymin = location.getBlockY() - r_y; ymax = location.getBlockY() + r_y; diff --git a/src/main/java/net/coreprotect/command/RollbackRestoreCommand.java b/src/main/java/net/coreprotect/command/RollbackRestoreCommand.java index 4227078..faecf34 100755 --- a/src/main/java/net/coreprotect/command/RollbackRestoreCommand.java +++ b/src/main/java/net/coreprotect/command/RollbackRestoreCommand.java @@ -157,7 +157,7 @@ public class RollbackRestoreCommand { int xmax = location.getBlockX() + DEFAULT_RADIUS; int zmin = location.getBlockZ() - DEFAULT_RADIUS; int zmax = location.getBlockZ() + DEFAULT_RADIUS; - argRadius = new Integer[] { DEFAULT_RADIUS, xmin, xmax, -1, -1, zmin, zmax, 0 }; + argRadius = new Integer[] { DEFAULT_RADIUS, xmin, xmax, null, null, zmin, zmax, 0 }; } // if (arg_radius==-2)arg_radius = -1; diff --git a/src/main/java/net/coreprotect/database/Lookup.java b/src/main/java/net/coreprotect/database/Lookup.java index f02e478..94dc4f2 100755 --- a/src/main/java/net/coreprotect/database/Lookup.java +++ b/src/main/java/net/coreprotect/database/Lookup.java @@ -484,15 +484,15 @@ public class Lookup extends Queue { } if (radius != null) { - int xmin = radius[1]; - int xmax = radius[2]; - int ymin = radius[3]; - int ymax = radius[4]; - int zmin = radius[5]; - int zmax = radius[6]; + Integer xmin = radius[1]; + Integer xmax = radius[2]; + Integer ymin = radius[3]; + Integer ymax = radius[4]; + Integer zmin = radius[5]; + Integer zmax = radius[6]; String queryY = ""; - if (ymin > -1 && ymax > -1) { + if (ymin != null && ymax != null) { queryY = " y >= '" + ymin + "' AND y <= '" + ymax + "' AND"; }