Added an alias for wool colors as though they were blocks, so you can now do //set blue, etc.

This commit is contained in:
sk89q 2011-03-10 00:48:13 -08:00
parent 5a3e703acc
commit 7d81303fea

View File

@ -198,7 +198,7 @@ public class WorldEdit {
String[] args1 = args0[0].split(":", 2);
String testID = args1[0];
int data;
int data = -1;
// Attempt to parse the item ID or otherwise resolve an item/block
// name to its numeric ID
@ -215,9 +215,18 @@ public class WorldEdit {
}
if (blockType == null) {
// Maybe it's a cloth
ClothColor col = ClothColor.lookup(testID);
if (col != null) {
blockType = BlockType.fromID(35);
data = col.getID();
} else {
throw new UnknownItemException(arg);
}
}
if (data == -1) { // Block data not yet detected
// Parse the block data (optional)
try {
data = args1.length > 1 ? Integer.parseInt(args1[1]) : 0;
@ -256,6 +265,7 @@ public class WorldEdit {
throw new InvalidItemException(arg, "Unknown data value '" + args1[1] + "'");
}
}
}
// Check if the item is allowed
if (allAllowed || player.hasPermission("worldedit.anyblock")