From 41299e685156311d74661fb9aefa90325dcd47c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Wed, 29 May 2019 14:49:27 +0200 Subject: [PATCH] Fix issue with plot border during merge * `getExtendedTopAbs()` used wrong relative plot for calculating X position. * Not running `finishPlotMerge()` after every merge led to broken roads during a `merge all` --- .../plotsquared/plot/object/Plot.java | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index 1b5d6186c..5f1b02e6f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java @@ -1669,7 +1669,7 @@ public class Plot { top.setZ(this.getRelative(Direction.SOUTH).getBottomAbs().getZ() - 1); } if (this.getMerged(Direction.EAST)) { - top.setX(this.getRelative(Direction.SOUTH).getBottomAbs().getX() - 1); + top.setX(this.getRelative(Direction.EAST).getBottomAbs().getX() - 1); } return top; } @@ -2243,6 +2243,13 @@ public class Plot { merged.add(current.getId()); merged.add(other.getId()); toReturn = true; + + if (removeRoads) { + ArrayList ids = new ArrayList<>(); + ids.add(current.getId()); + ids.add(other.getId()); + this.getManager().finishPlotMerge(this.area, ids); + } } } if (max >= 0 && (dir == -1 || dir == 1) && !current.getMerged(Direction.EAST)) { @@ -2255,6 +2262,13 @@ public class Plot { merged.add(current.getId()); merged.add(other.getId()); toReturn = true; + + if (removeRoads) { + ArrayList ids = new ArrayList<>(); + ids.add(current.getId()); + ids.add(other.getId()); + this.getManager().finishPlotMerge(this.area, ids); + } } } if (max >= 0 && (dir == -1 || dir == 2) && !getMerged(Direction.SOUTH)) { @@ -2267,6 +2281,13 @@ public class Plot { merged.add(current.getId()); merged.add(other.getId()); toReturn = true; + + if (removeRoads) { + ArrayList ids = new ArrayList<>(); + ids.add(current.getId()); + ids.add(other.getId()); + this.getManager().finishPlotMerge(this.area, ids); + } } } if (max >= 0 && (dir == -1 || dir == 3) && !getMerged(Direction.WEST)) { @@ -2279,13 +2300,16 @@ public class Plot { merged.add(current.getId()); merged.add(other.getId()); toReturn = true; + + if (removeRoads) { + ArrayList ids = new ArrayList<>(); + ids.add(current.getId()); + ids.add(other.getId()); + this.getManager().finishPlotMerge(this.area, ids); + } } } } - if (removeRoads && toReturn) { - ArrayList ids = new ArrayList<>(merged); - this.getManager().finishPlotMerge(this.area, ids); - } return toReturn; }