diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index 592865ab0..0f858dc7e 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -1526,16 +1526,13 @@ public class PS { } for (String areaId : areasSection.getKeys(false)) { PS.log(C.PREFIX + "&3 - " + areaId); - int i1 = areaId.indexOf('-'); - int i2 = areaId.indexOf(';'); - if (i1 == -1 || i2 == -1) { + String[] split = areaId.split("(?<=[^;-])-"); + if (split.length != 3) { throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `--`"); } - String name = areaId.substring(0, i1); - String rest = areaId.substring(i1 + 1); - int i3 = rest.indexOf('-', i2 - name.length() - 1); - PlotId pos1 = PlotId.fromString(rest.substring(0, i3)); - PlotId pos2 = PlotId.fromString(rest.substring(i3 + 1)); + String name = split[0]; + PlotId pos1 = PlotId.fromString(split[1]); + PlotId pos2 = PlotId.fromString(split[2]); if (pos1 == null || pos2 == null || name.isEmpty()) { throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `--`"); }