mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-02 08:50:17 +01:00
Fix area id parsing
This commit is contained in:
parent
d89274ce09
commit
364b4347d1
@ -1526,16 +1526,13 @@ public class PS {
|
|||||||
}
|
}
|
||||||
for (String areaId : areasSection.getKeys(false)) {
|
for (String areaId : areasSection.getKeys(false)) {
|
||||||
PS.log(C.PREFIX + "&3 - " + areaId);
|
PS.log(C.PREFIX + "&3 - " + areaId);
|
||||||
int i1 = areaId.indexOf('-');
|
String[] split = areaId.split("(?<=[^;-])-");
|
||||||
int i2 = areaId.indexOf(';');
|
if (split.length != 3) {
|
||||||
if (i1 == -1 || i2 == -1) {
|
|
||||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<pos1>-<pos2>`");
|
throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<pos1>-<pos2>`");
|
||||||
}
|
}
|
||||||
String name = areaId.substring(0, i1);
|
String name = split[0];
|
||||||
String rest = areaId.substring(i1 + 1);
|
PlotId pos1 = PlotId.fromString(split[1]);
|
||||||
int i3 = rest.indexOf('-', i2 - name.length() - 1);
|
PlotId pos2 = PlotId.fromString(split[2]);
|
||||||
PlotId pos1 = PlotId.fromString(rest.substring(0, i3));
|
|
||||||
PlotId pos2 = PlotId.fromString(rest.substring(i3 + 1));
|
|
||||||
if (pos1 == null || pos2 == null || name.isEmpty()) {
|
if (pos1 == null || pos2 == null || name.isEmpty()) {
|
||||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<x1;z1>-<x2;z2>`");
|
throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<x1;z1>-<x2;z2>`");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user