From cd0bc629310b6e7593b6a9422821a6a66f0b62a8 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Sun, 17 Nov 2013 16:10:15 +0100 Subject: [PATCH] WorldEdit.getBlock (and its callers) can now throw any WorldEditException. --- src/main/java/com/sk89q/worldedit/WorldEdit.java | 16 ++++++++-------- .../worldedit/scripting/CraftScriptContext.java | 9 +++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/WorldEdit.java b/src/main/java/com/sk89q/worldedit/WorldEdit.java index 95f34f494..8bfd54059 100644 --- a/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -367,7 +367,7 @@ public class WorldEdit { } public BaseBlock getBlock(LocalPlayer player, String arg, boolean allAllowed) - throws UnknownItemException, DisallowedItemException { + throws WorldEditException { return getBlock(player, arg, allAllowed, false); } @@ -384,7 +384,7 @@ public class WorldEdit { */ public BaseBlock getBlock(LocalPlayer player, String arg, boolean allAllowed, boolean allowNoData) - throws UnknownItemException, DisallowedItemException { + throws WorldEditException { BlockType blockType; arg = arg.replace("_", " "); arg = arg.replace(";", "|"); @@ -620,12 +620,12 @@ public class WorldEdit { * @throws DisallowedItemException */ public BaseBlock getBlock(LocalPlayer player, String id) - throws UnknownItemException, DisallowedItemException { + throws WorldEditException { return getBlock(player, id, false); } public Set getBlocks(LocalPlayer player, String list, boolean allAllowed, boolean allowNoData) - throws DisallowedItemException, UnknownItemException { + throws WorldEditException { String[] items = list.split(","); Set blocks = new HashSet(); for (String id : items) { @@ -635,12 +635,12 @@ public class WorldEdit { } public Set getBlocks(LocalPlayer player, String list, boolean allAllowed) - throws DisallowedItemException, UnknownItemException { + throws WorldEditException { return getBlocks(player, list, allAllowed, false); } public Set getBlocks(LocalPlayer player, String list) - throws DisallowedItemException, UnknownItemException { + throws WorldEditException { return getBlocks(player, list, false); } @@ -655,7 +655,7 @@ public class WorldEdit { * @throws DisallowedItemException */ public Pattern getBlockPattern(LocalPlayer player, String patternString) - throws UnknownItemException, DisallowedItemException { + throws WorldEditException { String[] items = patternString.split(","); @@ -804,7 +804,7 @@ public class WorldEdit { */ public Set getBlockIDs(LocalPlayer player, String list, boolean allBlocksAllowed) - throws UnknownItemException, DisallowedItemException { + throws WorldEditException { String[] items = list.split(","); Set blocks = new HashSet(); diff --git a/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java b/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java index b282151cc..f07ec4321 100644 --- a/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java +++ b/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java @@ -33,6 +33,7 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.ServerInterface; import com.sk89q.worldedit.UnknownItemException; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.commands.InsufficientArgumentsException; import com.sk89q.worldedit.patterns.Pattern; @@ -156,7 +157,7 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws DisallowedItemException */ public BaseBlock getBlock(String arg, boolean allAllowed) - throws UnknownItemException, DisallowedItemException { + throws WorldEditException { return controller.getBlock(player, arg, allAllowed); } @@ -169,7 +170,7 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws DisallowedItemException */ public BaseBlock getBlock(String id) - throws UnknownItemException, DisallowedItemException { + throws WorldEditException { return controller.getBlock(player, id, false); } @@ -182,7 +183,7 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws DisallowedItemException */ public Pattern getBlockPattern(String list) - throws UnknownItemException, DisallowedItemException { + throws WorldEditException { return controller.getBlockPattern(player, list); } @@ -196,7 +197,7 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws DisallowedItemException */ public Set getBlockIDs(String list, boolean allBlocksAllowed) - throws UnknownItemException, DisallowedItemException { + throws WorldEditException { return controller.getBlockIDs(player, list, allBlocksAllowed); }