From 7850644ab1a42f222731324c8a23fbd1a3a6277e Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 5 Apr 2015 14:01:31 +1000 Subject: [PATCH] *actually fixed it --- .../plot/generator/SquarePlotManager.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java index 71eca688d..eb59a889c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java @@ -35,8 +35,10 @@ public abstract class SquarePlotManager extends GridPlotManager { public PlotId getPlotIdAbs(final PlotWorld plotworld, int x, final int y, int z) { final SquarePlotWorld dpw = ((SquarePlotWorld) plotworld); int pathWidthLower; + int end; if (dpw.ROAD_WIDTH == 0) { pathWidthLower = -1; + end = dpw.PLOT_WIDTH; } else { if ((dpw.ROAD_WIDTH % 2) == 0) { @@ -44,6 +46,7 @@ public abstract class SquarePlotManager extends GridPlotManager { } else { pathWidthLower = dpw.ROAD_WIDTH / 2; } + end = pathWidthLower + dpw.PLOT_WIDTH; } final int size = dpw.PLOT_WIDTH + dpw.ROAD_WIDTH; int idx; @@ -64,7 +67,6 @@ public abstract class SquarePlotManager extends GridPlotManager { idz = (z/size) + 1; z = (z % size); } - final int end = pathWidthLower + dpw.PLOT_WIDTH; final boolean northSouth = (z <= pathWidthLower) || (z > end); final boolean eastWest = (x <= pathWidthLower) || (x > end); if (northSouth || eastWest) { @@ -81,10 +83,18 @@ public abstract class SquarePlotManager extends GridPlotManager { } final int size = dpw.PLOT_WIDTH + dpw.ROAD_WIDTH; int pathWidthLower; - if ((dpw.ROAD_WIDTH % 2) == 0) { - pathWidthLower = (dpw.ROAD_WIDTH / 2) - 1; - } else { - pathWidthLower = dpw.ROAD_WIDTH / 2; + final int end; + if (dpw.ROAD_WIDTH == 0) { + pathWidthLower = -1; + end = dpw.PLOT_WIDTH; + } + else { + if ((dpw.ROAD_WIDTH % 2) == 0) { + pathWidthLower = (dpw.ROAD_WIDTH / 2) - 1; + } else { + pathWidthLower = dpw.ROAD_WIDTH / 2; + } + end = pathWidthLower + dpw.PLOT_WIDTH; } int dx; int dz; @@ -106,7 +116,6 @@ public abstract class SquarePlotManager extends GridPlotManager { dz = (z/size) + 1; rz = (z % size); } - final int end = pathWidthLower + dpw.PLOT_WIDTH; final boolean northSouth = (rz <= pathWidthLower) || (rz > end); final boolean eastWest = (rx <= pathWidthLower) || (rx > end); if (northSouth && eastWest) {