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 52659dc7..760e001c 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 @@ -37,6 +37,25 @@ public Bounds(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { } public Bounds(Position min, Position max) { + // 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 (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 (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); + } + this.minX = min.blockX(); this.minY = min.blockY(); this.minZ = min.blockZ(); diff --git a/plugin/src/main/java/org/battleplugins/arena/editor/ArenaEditorWizards.java b/plugin/src/main/java/org/battleplugins/arena/editor/ArenaEditorWizards.java index f1d64834..0c99336b 100644 --- a/plugin/src/main/java/org/battleplugins/arena/editor/ArenaEditorWizards.java +++ b/plugin/src/main/java/org/battleplugins/arena/editor/ArenaEditorWizards.java @@ -84,7 +84,7 @@ public final class ArenaEditorWizards { try { map.save(); } catch (ParseException | IOException e) { - BattleArena.getInstance().error("Failed to create map file for arena {}", ctx.getArena().getName(), e); + BattleArena.getInstance().error("Failed to save map file for arena {}", ctx.getArena().getName(), e); Messages.MAP_FAILED_TO_SAVE.send(ctx.getPlayer(), map.getName()); return; } @@ -95,25 +95,6 @@ public final class ArenaEditorWizards { Position min = ctx.getMin(); Position max = ctx.getMax(); - // 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 (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 (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); - } - Bounds bounds = new Bounds(min, max); Map teamSpawns = new HashMap<>(ctx.getSpawns().size());