mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Fix single plot areas
This commit is contained in:
parent
19fe39ce2e
commit
ed588476e0
@ -25,6 +25,14 @@ public class PlotId {
|
|||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a Plot Id based on a string
|
* Get a Plot Id based on a string
|
||||||
*
|
*
|
||||||
@ -40,7 +48,7 @@ public class PlotId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable public static PlotId fromStringOrNull(@NotNull String string) {
|
@Nullable public static PlotId fromStringOrNull(@NotNull String string) {
|
||||||
String[] parts = string.split("[;|,]");
|
String[] parts = string.split("[;,.]");
|
||||||
if (parts.length < 2) {
|
if (parts.length < 2) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class SinglePlot extends Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getWorldName() {
|
@Override public String getWorldName() {
|
||||||
return getId().toCommaSeparatedString();
|
return getId().getX() + "." + getId().getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public SinglePlotArea getArea() {
|
@Override public SinglePlotArea getArea() {
|
||||||
|
@ -47,7 +47,7 @@ public class SinglePlotArea extends GridPlotWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadWorld(final PlotId id) {
|
public void loadWorld(final PlotId id) {
|
||||||
String worldName = id.toCommaSeparatedString();
|
String worldName = id.getX() + "." + id.getY();
|
||||||
if (WorldUtil.IMP.isWorld(worldName)) {
|
if (WorldUtil.IMP.isWorld(worldName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -59,12 +59,19 @@ public class SinglePlotArea extends GridPlotWorld {
|
|||||||
setup.step = new ConfigurationNode[0];
|
setup.step = new ConfigurationNode[0];
|
||||||
setup.world = worldName;
|
setup.world = worldName;
|
||||||
|
|
||||||
// Duplicate 0;0
|
|
||||||
if (setup.type != 0) {
|
|
||||||
File container = PlotSquared.imp().getWorldContainer();
|
File container = PlotSquared.imp().getWorldContainer();
|
||||||
File destination = new File(container, worldName);
|
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) {
|
||||||
if (!destination.exists()) {
|
if (!destination.exists()) {
|
||||||
File src = new File(container, "0,0");
|
File src = new File(container, "0.0");
|
||||||
if (src.exists()) {
|
if (src.exists()) {
|
||||||
if (!destination.exists()) {
|
if (!destination.exists()) {
|
||||||
destination.mkdirs();
|
destination.mkdirs();
|
||||||
@ -93,7 +100,7 @@ public class SinglePlotArea extends GridPlotWorld {
|
|||||||
|
|
||||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override public void run(Object value) {
|
@Override public void run(Object value) {
|
||||||
String worldName = id.toCommaSeparatedString();
|
String worldName = id.getX() + "." + id.getY();
|
||||||
if (WorldUtil.IMP.isWorld(worldName)) {
|
if (WorldUtil.IMP.isWorld(worldName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
if ((c <= '/') || (c >= ':')) {
|
if ((c <= '/') || (c >= ':')) {
|
||||||
if (c == ';' || c == ',') {
|
if (c == '.') {
|
||||||
mode = 2;
|
mode = 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user