Added support for Towny Advanced 0.75

This commit is contained in:
FrozenCow 2011-08-27 20:24:37 +02:00
parent 069d4c0ce5
commit a3573c7a64

View File

@ -124,16 +124,35 @@ public class TownyConfigHandler {
n = n.substring(idx+1); /* Process remainder as coordinate */
}
if(!worldmatch) continue;
String[] v = n.split(",");
if(v.length == 2) {
java.util.regex.Matcher towny075Match = towny075Pattern.matcher(n);
if (towny075Match.matches()) {
// Towny Advanced >= 0.75
try {
int[] vv = new int[] { Integer.valueOf(v[0]), Integer.valueOf(v[1]) };
//int plotType = Integer.valueOf(towny075Match.group(1));
int[] vv = new int[] { Integer.valueOf(towny075Match.group(2)), Integer.valueOf(towny075Match.group(3)) };
blks.setFlag(vv[0], vv[1], true);
nodevals.add(vv);
} catch (NumberFormatException nfx) {
} catch(NumberFormatException nfx) {
Log.severe("Error parsing block list in Towny - " + townfile.getPath());
return null;
}
} else {
// Towny Advanced < 0.75
String[] v = n.split(",");
if(v.length == 2) {
try {
int[] vv = new int[] { Integer.valueOf(v[0]), Integer.valueOf(v[1]) };
blks.setFlag(vv[0], vv[1], true);
nodevals.add(vv);
} catch (NumberFormatException nfx) {
Log.severe("Error parsing block list in Towny - " + townfile.getPath());
return null;
}
} else {
Log.severe("Invalid block list format in Towny - " + townfile.getPath());
return null;
}
}
}
/* If nothing in this world, skip */