From fc93156362771f5d87e9f68f284a4b81f7f56fa3 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 9 Feb 2022 14:21:51 +0000 Subject: [PATCH] Don't overly extend height when regenerating road region --- .../core/plot/PlotModificationManager.java | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java index 5b81a2394..042c2e14f 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java @@ -525,28 +525,6 @@ public final class PlotModificationManager { return false; } - /** - * Remove the south road section of a plot
- * - Used when a plot is merged
- * - * @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues, - * otherwise writes to the queue but does not enqueue. - */ - public void removeRoadSouth(final @Nullable QueueCoordinator queue) { - if (this.plot.getArea().getType() != PlotAreaType.NORMAL && this.plot - .getArea() - .getTerrain() == PlotAreaTerrainType.ROAD) { - Plot other = this.plot.getRelative(Direction.SOUTH); - Location bot = other.getBottomAbs(); - Location top = this.plot.getTopAbs(); - Location pos1 = Location.at(this.plot.getWorldName(), bot.getX(), plot.getArea().getMinGenHeight(), top.getZ()); - Location pos2 = Location.at(this.plot.getWorldName(), top.getX(), plot.getArea().getMaxGenHeight() + 1, bot.getZ()); - PlotSquared.platform().regionManager().regenerateRegion(pos1, pos2, true, null); - } else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove - this.plot.getManager().removeRoadSouth(this.plot, queue); - } - } - /** * Auto merge a plot in a specific direction. * @@ -913,6 +891,28 @@ public final class PlotModificationManager { return this.setComponent(component, parsed.toPattern(), actor, queue); } + /** + * Remove the south road section of a plot
+ * - Used when a plot is merged
+ * + * @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues, + * otherwise writes to the queue but does not enqueue. + */ + public void removeRoadSouth(final @Nullable QueueCoordinator queue) { + if (this.plot.getArea().getType() != PlotAreaType.NORMAL && this.plot + .getArea() + .getTerrain() == PlotAreaTerrainType.ROAD) { + Plot other = this.plot.getRelative(Direction.SOUTH); + Location bot = other.getBottomAbs(); + Location top = this.plot.getTopAbs(); + Location pos1 = Location.at(this.plot.getWorldName(), bot.getX(), plot.getArea().getMinGenHeight(), top.getZ()); + Location pos2 = Location.at(this.plot.getWorldName(), top.getX(), plot.getArea().getMaxGenHeight(), bot.getZ()); + PlotSquared.platform().regionManager().regenerateRegion(pos1, pos2, true, null); + } else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove + this.plot.getManager().removeRoadSouth(this.plot, queue); + } + } + /** * Remove the east road section of a plot
* - Used when a plot is merged
@@ -928,7 +928,7 @@ public final class PlotModificationManager { Location bot = other.getBottomAbs(); Location top = this.plot.getTopAbs(); Location pos1 = Location.at(this.plot.getWorldName(), top.getX(), plot.getArea().getMinGenHeight(), bot.getZ()); - Location pos2 = Location.at(this.plot.getWorldName(), bot.getX(), plot.getArea().getMaxGenHeight() + 1, top.getZ()); + Location pos2 = Location.at(this.plot.getWorldName(), bot.getX(), plot.getArea().getMaxGenHeight(), top.getZ()); PlotSquared.platform().regionManager().regenerateRegion(pos1, pos2, true, null); } else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove this.plot.getArea().getPlotManager().removeRoadEast(this.plot, queue);