From 3d4d413de851d5de8f9ada28f851cdd545f4d997 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Tue, 2 Nov 2021 15:41:16 +0000 Subject: [PATCH] Minor adjustment to plot home location logic - Allow "centre" spelling - ClassicPlotWorld contains the PLOT_HEIGHT config setting, not HPW --- .../com/plotsquared/core/database/SQLManager.java | 2 ++ .../java/com/plotsquared/core/location/PlotLoc.java | 2 +- .../main/java/com/plotsquared/core/plot/Plot.java | 12 +++++++----- .../java/com/plotsquared/core/plot/PlotArea.java | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java index dba81e1eb..4866c252b 100644 --- a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java +++ b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java @@ -2099,6 +2099,7 @@ public class SQLManager implements AbstractDB { case "default": case "0,0,0": case "center": + case "centre": break; default: try { @@ -2946,6 +2947,7 @@ public class SQLManager implements AbstractDB { case "default": case "0,0,0": case "center": + case "centre": break; default: try { diff --git a/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java b/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java index d3f04e1de..d41b8dcc6 100644 --- a/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java +++ b/Core/src/main/java/com/plotsquared/core/location/PlotLoc.java @@ -56,7 +56,7 @@ public final class PlotLoc { public static @Nullable PlotLoc fromString(final String input) { if (input == null || "side".equalsIgnoreCase(input)) { return null; - } else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle")) { + } else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle", "centre")) { return new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE); } else { try { diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java index 7e4e83a48..f3e6519d2 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -39,6 +39,7 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.events.Result; import com.plotsquared.core.events.TeleportCause; +import com.plotsquared.core.generator.ClassicPlotWorld; import com.plotsquared.core.generator.HybridPlotWorld; import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.location.BlockLoc; @@ -1328,7 +1329,7 @@ public class Plot { return Location.at( "", 0, - this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, + this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, 0 ); } @@ -1403,7 +1404,7 @@ public class Plot { return Location.at( "", 0, - this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, + this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, 0 ); } @@ -1442,7 +1443,7 @@ public class Plot { result.accept(Location.at( "", 0, - this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, + this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, 0 )); return; @@ -1539,7 +1540,7 @@ public class Plot { result.accept(Location.at( "", 0, - this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, + this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, 0 )); return; @@ -1572,7 +1573,8 @@ public class Plot { y -> result.accept(Location.at(plot.getWorldName(), x, y + 1, z)) ); } else { - result.accept(Location.at(plot.getWorldName(), x, 63, z, loc.getYaw(), loc.getPitch())); + int y = this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 63; + result.accept(Location.at(plot.getWorldName(), x, y, z, loc.getYaw(), loc.getPitch())); } } else { result.accept(Location.at(plot.getWorldName(), x, loc.getY(), z, loc.getYaw(), loc.getPitch())); diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java index 2295eb652..8b5f7c069 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -381,7 +381,7 @@ public abstract class PlotArea { if ("side".equalsIgnoreCase(homeDefault)) { this.defaultHome = null; - } else if (StringMan.isEqualIgnoreCaseToAny(homeDefault, "center", "middle")) { + } else if (StringMan.isEqualIgnoreCaseToAny(homeDefault, "center", "middle", "centre")) { this.defaultHome = new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE); } else { try {