From e4771416aac39ade80a92913b13b19f4c58de6c9 Mon Sep 17 00:00:00 2001 From: Wizjany Date: Mon, 24 Dec 2012 01:01:01 -0500 Subject: [PATCH] Added new items for 1.4.6 Fix permission for other help command (why are there two?) - Made registerhelp read from yaml (not that the setting does anything) Added an option to override data value limits. - This should fix some mods which use data values above 16 - May cause issues if set to true and people mess with vanilla data values --- .../java/com/sk89q/worldedit/LocalConfiguration.java | 3 ++- src/main/java/com/sk89q/worldedit/WorldEdit.java | 9 +++++---- src/main/java/com/sk89q/worldedit/blocks/ItemID.java | 3 +++ src/main/java/com/sk89q/worldedit/blocks/ItemType.java | 6 ++++++ .../java/com/sk89q/worldedit/bukkit/BukkitWorld.java | 2 +- .../com/sk89q/worldedit/commands/UtilityCommands.java | 1 + .../java/com/sk89q/worldedit/util/YAMLConfiguration.java | 4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/LocalConfiguration.java b/src/main/java/com/sk89q/worldedit/LocalConfiguration.java index 487db6728..e81c3c724 100644 --- a/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -90,7 +90,7 @@ public abstract class LocalConfiguration { public int maxSuperPickaxeSize = 5; public int maxBrushRadius = 6; public boolean logCommands = false; - public boolean registerHelp = true; + public boolean registerHelp = true; // what is the point of this, it's not even used public int wandItem = ItemID.WOOD_AXE; public boolean superPickaxeDrop = true; public boolean superPickaxeManyDrop = true; @@ -106,6 +106,7 @@ public abstract class LocalConfiguration { public boolean showFirstUseVersion = true; public int butcherDefaultRadius = -1; public int butcherMaxRadius = -1; + public boolean allowExtraDataValues = false; /** * Loads the configuration. diff --git a/src/main/java/com/sk89q/worldedit/WorldEdit.java b/src/main/java/com/sk89q/worldedit/WorldEdit.java index 5f48b4ab1..8338552de 100644 --- a/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -418,7 +418,7 @@ public class WorldEdit { // Parse the block data (optional) try { data = (typeAndData.length > 1 && typeAndData[1].length() > 0) ? Integer.parseInt(typeAndData[1]) : (allowNoData ? -1 : 0); - if (data > 15 || (data < 0 && !(allAllowed && data == -1))) { + if ((data > 15 && !config.allowExtraDataValues) || (data < 0 && !(allAllowed && data == -1))) { data = 0; } } catch (NumberFormatException e) { @@ -443,15 +443,12 @@ public class WorldEdit { case STONE: data = 0; break; - case SANDSTONE: data = 1; break; - case WOOD: data = 2; break; - case COBBLESTONE: data = 3; break; @@ -460,6 +457,10 @@ public class WorldEdit { break; case STONE_BRICK: data = 5; + break; + case NETHER_BRICK: + data = 6; + break; default: throw new InvalidItemException(arg, "Invalid step type '" + typeAndData[1] + "'"); diff --git a/src/main/java/com/sk89q/worldedit/blocks/ItemID.java b/src/main/java/com/sk89q/worldedit/blocks/ItemID.java index e34c754f0..c7d2097d9 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/ItemID.java +++ b/src/main/java/com/sk89q/worldedit/blocks/ItemID.java @@ -170,6 +170,9 @@ public final class ItemID { public static final int CARROT_ON_A_STICK = 398; public static final int NETHER_STAR = 399; public static final int PUMPKIN_PIE = 400; + public static final int FIREWORK_ROCKET = 401; + public static final int FIREWORK_STAR = 402; + public static final int ENCHANTED_BOOK = 403; @Deprecated public static final int GOLD_RECORD = 2256; // deprecated, but leave it there @Deprecated public static final int GREEN_RECORD = 2257; // deprecated, but leave it there diff --git a/src/main/java/com/sk89q/worldedit/blocks/ItemType.java b/src/main/java/com/sk89q/worldedit/blocks/ItemType.java index 841a15536..de37616b5 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/ItemType.java +++ b/src/main/java/com/sk89q/worldedit/blocks/ItemType.java @@ -328,6 +328,9 @@ public enum ItemType { CARROT_ON_A_STICK(ItemID.CARROT_ON_A_STICK, "Carrot on a stick", "carrotonastick", "carrotonstick", "stickcarrot", "carrotstick"), NETHER_STAR(ItemID.NETHER_STAR, "Nether star", "netherstar", "starnether"), PUMPKIN_PIE(ItemID.PUMPKIN_PIE, "Pumpkin pie", "pumpkinpie"), + FIREWORK_ROCKET(ItemID.FIREWORK_ROCKET, "Firework rocket", "firework", "rocket"), + FIREWORK_STAR(ItemID.FIREWORK_STAR, "Firework star", "fireworkstar", "fireworkcharge"), + ENCHANTED_BOOK(ItemID.ENCHANTED_BOOK, "Enchanted book", "enchantedbook", "spellbook", "enchantedtome", "tome"), DISC_13(ItemID.DISC_13, "Music Disc - 13", "disc_13"), DISC_CAT(ItemID.DISC_CAT, "Music Disc - Cat", "disc_cat"), DISC_BLOCKS(ItemID.DISC_BLOCKS, "Music Disc - blocks", "disc_blocks"), @@ -553,6 +556,9 @@ public enum ItemType { shouldNotStack.add(ItemID.MAP); shouldNotStack.add(ItemID.SHEARS); shouldNotStack.add(ItemID.HEAD); + shouldNotStack.add(ItemID.FIREWORK_ROCKET); + shouldNotStack.add(ItemID.FIREWORK_STAR); + shouldNotStack.add(ItemID.ENCHANTED_BOOK); shouldNotStack.add(ItemID.DISC_13); shouldNotStack.add(ItemID.DISC_CAT); shouldNotStack.add(ItemID.DISC_BLOCKS); diff --git a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index ad1138023..0af3f24a6 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -434,7 +434,7 @@ public class BukkitWorld extends LocalWorld { * Gets the single block inventory for a potentially double chest. * Handles people who have an old version of Bukkit. * This should be replaced with {@link org.bukkit.block.Chest#getBlockInventory()} - * in a few months (now = March 2012) + * in a few months (now = March 2012) // note from future dev - lol * * @param chest The chest to get a single block inventory for * @return The chest's inventory diff --git a/src/main/java/com/sk89q/worldedit/commands/UtilityCommands.java b/src/main/java/com/sk89q/worldedit/commands/UtilityCommands.java index c8b3e0a07..9189cbf27 100644 --- a/src/main/java/com/sk89q/worldedit/commands/UtilityCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/UtilityCommands.java @@ -497,6 +497,7 @@ public class UtilityCommands { max = -1 ) @Console + @CommandPermissions("worldedit.help") public void help(CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession) throws WorldEditException { diff --git a/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java b/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java index 1aa05f784..e33029fe9 100644 --- a/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java +++ b/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java @@ -73,7 +73,7 @@ public class YAMLConfiguration extends LocalConfiguration { "limits.max-super-pickaxe-size", maxSuperPickaxeSize)); butcherDefaultRadius = Math.max(-1, config.getInt("limits.butcher-radius.default", butcherDefaultRadius)); butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius)); - registerHelp = true; + registerHelp = config.getBoolean("register-help"); logCommands = config.getBoolean("logging.log-commands", logCommands); superPickaxeDrop = config.getBoolean("super-pickaxe.drop-items", superPickaxeDrop); @@ -97,6 +97,8 @@ public class YAMLConfiguration extends LocalConfiguration { allowedDataCycleBlocks = new HashSet(config.getIntList("limits.allowed-data-cycle-blocks", null)); + allowExtraDataValues = config.getBoolean("limits.allow-extra-data-values", false); + LocalSession.MAX_HISTORY_SIZE = Math.max(0, config.getInt("history.size", 15)); LocalSession.EXPIRATION_GRACE = config.getInt("history.expiration", 10) * 60 * 1000;