Fix single plot areas

This commit is contained in:
Jesse Boyd 2019-11-08 22:31:01 +00:00
parent 19fe39ce2e
commit ed588476e0
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
4 changed files with 23 additions and 8 deletions

View File

@ -25,6 +25,14 @@ public class PlotId {
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
/**
* Get a Plot Id based on a string
*
@ -40,7 +48,7 @@ public class PlotId {
}
@Nullable public static PlotId fromStringOrNull(@NotNull String string) {
String[] parts = string.split("[;|,]");
String[] parts = string.split("[;,.]");
if (parts.length < 2) {
return null;
}

View File

@ -44,7 +44,7 @@ public class SinglePlot extends Plot {
}
@Override public String getWorldName() {
return getId().toCommaSeparatedString();
return getId().getX() + "." + getId().getY();
}
@Override public SinglePlotArea getArea() {

View File

@ -47,7 +47,7 @@ public class SinglePlotArea extends GridPlotWorld {
}
public void loadWorld(final PlotId id) {
String worldName = id.toCommaSeparatedString();
String worldName = id.getX() + "." + id.getY();
if (WorldUtil.IMP.isWorld(worldName)) {
return;
}
@ -59,12 +59,19 @@ public class SinglePlotArea extends GridPlotWorld {
setup.step = new ConfigurationNode[0];
setup.world = worldName;
File container = PlotSquared.imp().getWorldContainer();
File destination = new File(container, worldName);
{// convert old
File oldFile = new File(container, id.toCommaSeparatedString());
if (oldFile.exists()) {
oldFile.renameTo(destination);
}
}
// Duplicate 0;0
if (setup.type != 0) {
File container = PlotSquared.imp().getWorldContainer();
File destination = new File(container, worldName);
if (!destination.exists()) {
File src = new File(container, "0,0");
File src = new File(container, "0.0");
if (src.exists()) {
if (!destination.exists()) {
destination.mkdirs();
@ -93,7 +100,7 @@ public class SinglePlotArea extends GridPlotWorld {
TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override public void run(Object value) {
String worldName = id.toCommaSeparatedString();
String worldName = id.getX() + "." + id.getY();
if (WorldUtil.IMP.isWorld(worldName)) {
return;
}

View File

@ -44,7 +44,7 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
}
case 1:
if ((c <= '/') || (c >= ':')) {
if (c == ';' || c == ',') {
if (c == '.') {
mode = 2;
continue;
}