diff --git a/plugin/src/main/java/org/battleplugins/arena/competition/map/options/Bounds.java b/plugin/src/main/java/org/battleplugins/arena/competition/map/options/Bounds.java index 760e001c..7069572f 100644 --- a/plugin/src/main/java/org/battleplugins/arena/competition/map/options/Bounds.java +++ b/plugin/src/main/java/org/battleplugins/arena/competition/map/options/Bounds.java @@ -26,43 +26,37 @@ public class Bounds { public Bounds() { } - public Bounds(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { - this.minX = minX; - this.minY = minY; - this.minZ = minZ; - - this.maxX = maxX; - this.maxY = maxY; - this.maxZ = maxZ; + public Bounds(Position min, Position max) { + this(min.blockX(), min.blockY(), min.blockZ(), max.blockX(), max.blockY(), max.blockZ()); } - public Bounds(Position min, Position max) { + public Bounds(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { // Sanitize min max - if (min.blockX() > max.blockX()) { - int temp = min.blockX(); - min = Position.block(max.blockX(), min.blockY(), min.blockZ()); - max = Position.block(temp, max.blockY(), max.blockZ()); + if (minX > maxX) { + int temp = minX; + minX = maxX; + maxX = temp; } - if (min.blockY() > max.blockY()) { - int temp = min.blockY(); - min = Position.block(min.blockX(), max.blockY(), min.blockZ()); - max = Position.block(max.blockX(), temp, max.blockZ()); + if (minY > maxY) { + int temp = minY; + minY = maxY; + maxY = temp; } - if (min.blockZ() > max.blockZ()) { - int temp = min.blockZ(); - min = Position.block(min.blockX(), min.blockY(), max.blockZ()); - max = Position.block(max.blockX(), max.blockY(), temp); + if (minZ > maxZ) { + int temp = minZ; + minZ = maxZ; + maxZ = temp; } - this.minX = min.blockX(); - this.minY = min.blockY(); - this.minZ = min.blockZ(); + this.minX = minX; + this.minY = minY; + this.minZ = minZ; - this.maxX = max.blockX(); - this.maxY = max.blockY(); - this.maxZ = max.blockZ(); + this.maxX = maxX; + this.maxY = maxY; + this.maxZ = maxZ; } public int getMinX() {