3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 11:00:05 +01:00

Improved parsing of block pattern/data syntax.

Dieser Commit ist enthalten in:
sk89q 2011-02-18 16:24:56 -08:00
Ursprung e94c1d4874
Commit 21ca317d2c

Datei anzeigen

@ -247,8 +247,14 @@ public class WorldEdit {
// Allow setting mob spawn type
} else if (blockType == BlockType.MOB_SPAWNER) {
if (args0.length > 1) {
if (!server.isValidMobType(args0[1])) {
throw new InvalidItemException(arg, "Unknown mob type '" + args0[1] + "'");
String mobName = args0[1];
if (mobName.length() > 1) {
mobName = mobName.substring(0, 1).toUpperCase()
+ mobName.substring(1);
}
if (!server.isValidMobType(mobName)) {
throw new InvalidItemException(arg, "Unknown mob type '" + mobName + "'");
}
return new MobSpawnerBlock(data, args0[1]);
} else {
@ -303,6 +309,8 @@ public class WorldEdit {
String[] items = list.split(",");
// Handle special block pattern types
if (list.charAt(0) == '#') {
if (list.equals("#clipboard") || list.equals("#copy")) {
LocalSession session = getSession(player);
CuboidClipboard clipboard;
@ -315,8 +323,12 @@ public class WorldEdit {
}
return new ClipboardPattern(clipboard);
} else {
throw new UnknownItemException(list);
}
}
// If it's only one block, then just return that single one
if (items.length == 1) {
return new SingleBlockPattern(getBlock(player, items[0]));
}
@ -327,6 +339,8 @@ public class WorldEdit {
BaseBlock block;
double chance;
// Parse special percentage syntax
if (s.matches("[0-9]+(?:\\.(?:[0-9]+)?)?%.*")) {
String[] p = s.split("%");
chance = Double.parseDouble(p[0]);