diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java index 418b77c2d..92f638461 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/managers/BukkitWorldManager.java @@ -32,7 +32,6 @@ import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.WorldType; -import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/Core/src/main/java/com/plotsquared/core/command/Area.java b/Core/src/main/java/com/plotsquared/core/command/Area.java index 052c8b07f..6be75addf 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Area.java +++ b/Core/src/main/java/com/plotsquared/core/command/Area.java @@ -663,7 +663,7 @@ public class Area extends SubCommand { Location center; if (area instanceof SinglePlotArea) { ((SinglePlotArea) area).loadWorld(PlotId.of(0, 0)); - center = this.worldUtil.getSpawn(PlotId.of(0, 0).toSeparatedString("_")); + center = this.worldUtil.getSpawn(PlotId.of(0, 0).toUnderscoreSeparatedString()); player.teleport(center, TeleportCause.COMMAND); } else if (area.getType() != PlotAreaType.PARTIAL) { center = this.worldUtil.getSpawn(area.getWorldName()); diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotId.java b/Core/src/main/java/com/plotsquared/core/plot/PlotId.java index 71755ef50..f77285122 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotId.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotId.java @@ -242,6 +242,16 @@ public final class PlotId { return this.getX() + "," + this.getY(); } + /** + * Get a String representation of the plot ID where the + * components are separated by "_" + * + * @return {@code x + "_" + y} + */ + @Nonnull public String toUnderscoreSeparatedString() { + return this.getX() + "_" + this.getY(); + } + /** * Get a String representation of the plot ID where the * components are separated by "-" diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java index 32aeaa950..ff5ebbdf9 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlot.java @@ -60,7 +60,7 @@ public class SinglePlot extends Plot { } @Override public String getWorldName() { - return getId().toSeparatedString("_"); + return getId().toUnderscoreSeparatedString(); } @Override public SinglePlotArea getArea() { diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java index 821674be9..8a6e5f023 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java @@ -87,7 +87,7 @@ public class SinglePlotArea extends GridPlotWorld { } public void loadWorld(final PlotId id) { - String worldName = id.toSeparatedString("_"); + String worldName = id.toUnderscoreSeparatedString(); if (PlotSquared.platform().worldUtil().isWorld(worldName)) { return; } @@ -145,7 +145,7 @@ public class SinglePlotArea extends GridPlotWorld { try { TaskManager.getPlatformImplementation().sync(() -> { - final String name = id.toSeparatedString("_"); + final String name = id.toUnderscoreSeparatedString(); if (!PlotSquared.platform().worldUtil().isWorld(name)) { PlotSquared.platform().setupUtils().setupWorld(builder); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java index ba0a61c3e..38f243ef8 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java @@ -44,6 +44,8 @@ import java.util.List; public class SinglePlotManager extends PlotManager { + private static final int MAX_COORDINATE = 30000000; + public SinglePlotManager(@Nonnull final PlotArea plotArea) { super(plotArea); } @@ -57,11 +59,11 @@ public class SinglePlotManager extends PlotManager { } @Override public Location getPlotBottomLocAbs(@Nonnull final PlotId plotId) { - return Location.at(plotId.toSeparatedString("_"), -30000000, 0, -30000000); + return Location.at(plotId.toUnderscoreSeparatedString(), -MAX_COORDINATE, 0, -MAX_COORDINATE); } @Override public Location getPlotTopLocAbs(@Nonnull final PlotId plotId) { - return Location.at(plotId.toSeparatedString("_"), 30000000, 0, 30000000); + return Location.at(plotId.toUnderscoreSeparatedString(), MAX_COORDINATE, 0, MAX_COORDINATE); } @Override public boolean clearPlot(@Nonnull Plot plot, final Runnable whenDone, @Nullable PlotPlayer actor, @Nullable QueueCoordinator queue) {