From 5665e9b7090671f81f23a8de80295376d691299e Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 20 May 2016 03:25:45 +1000 Subject: [PATCH] Fix merging sometimes not removing intersection --- .../plot/object/Plot.java | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java index 8c7f5fafd..0d270a78e 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -22,7 +22,6 @@ import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; import com.plotsquared.listener.PlotListener; - import java.awt.Rectangle; import java.awt.geom.Area; import java.awt.geom.PathIterator; @@ -558,6 +557,7 @@ public class Plot { case 7: int i = direction - 4; int i2 = 0; + System.out.println("CHECK 7 " + this + " | " + this.id.getRelative(i) + " | " + this.id.getRelative(i2) + " | " + i + " | " + i2); if (this.getSettings().getMerged(i2)) { if (this.getSettings().getMerged(i)) { if (this.area.getPlotAbs(this.id.getRelative(i)).getMerged(i2)) { @@ -2643,16 +2643,18 @@ public class Plot { lesserPlot.setMerged(2, true); greaterPlot.setMerged(0, true); lesserPlot.mergeData(greaterPlot); + System.out.println(greaterPlot + " | " + lesserPlot); if (removeRoads) { lesserPlot.removeRoadSouth(); - Plot other = this.getRelative(3); - if (other.getMerged(2) && other.getMerged(1)) { - greaterPlot.mergePlot(other, removeRoads); - other.removeRoadEast(); - } - if (lesserPlot.getMerged(5)) { + Plot diagonal = greaterPlot.getRelative(1); + if (diagonal.getMerged(7)) { + System.out.println(lesserPlot + " SOUTHEAST 1"); lesserPlot.removeRoadSouthEast(); } + Plot below = greaterPlot.getRelative(3); + if (below.getMerged(4)) { + below.getRelative(0).removeRoadSouthEast(); + } } } } else { @@ -2667,17 +2669,19 @@ public class Plot { lesserPlot.setMerged(1, true); greaterPlot.setMerged(3, true); lesserPlot.mergeData(greaterPlot); + System.out.println(greaterPlot + " | " + lesserPlot); if (removeRoads) { - Plot other = lesserPlot.getRelative(0); - if (other.getMerged(2) && other.getMerged(1)) { - greaterPlot.mergePlot(other, removeRoads); - other.removeRoadSouthEast(); - } - if (lesserPlot.getMerged(5)) { + Plot diagonal = greaterPlot.getRelative(1); + if (diagonal.getMerged(7)) { + System.out.println(lesserPlot + " SOUTHEAST 2"); lesserPlot.removeRoadSouthEast(); } lesserPlot.removeRoadEast(); } + Plot below = greaterPlot.getRelative(0); + if (below.getMerged(6)) { + below.getRelative(3).removeRoadSouthEast(); + } } } }