WorldEdit.getBlock (and its callers) can now throw any WorldEditException.

This commit is contained in:
TomyLobo 2013-11-17 16:10:15 +01:00
parent 79bcfd815b
commit cd0bc62931
2 changed files with 13 additions and 12 deletions

View File

@ -367,7 +367,7 @@ public class WorldEdit {
} }
public BaseBlock getBlock(LocalPlayer player, String arg, boolean allAllowed) public BaseBlock getBlock(LocalPlayer player, String arg, boolean allAllowed)
throws UnknownItemException, DisallowedItemException { throws WorldEditException {
return getBlock(player, arg, allAllowed, false); return getBlock(player, arg, allAllowed, false);
} }
@ -384,7 +384,7 @@ public class WorldEdit {
*/ */
public BaseBlock getBlock(LocalPlayer player, String arg, public BaseBlock getBlock(LocalPlayer player, String arg,
boolean allAllowed, boolean allowNoData) boolean allAllowed, boolean allowNoData)
throws UnknownItemException, DisallowedItemException { throws WorldEditException {
BlockType blockType; BlockType blockType;
arg = arg.replace("_", " "); arg = arg.replace("_", " ");
arg = arg.replace(";", "|"); arg = arg.replace(";", "|");
@ -620,12 +620,12 @@ public class WorldEdit {
* @throws DisallowedItemException * @throws DisallowedItemException
*/ */
public BaseBlock getBlock(LocalPlayer player, String id) public BaseBlock getBlock(LocalPlayer player, String id)
throws UnknownItemException, DisallowedItemException { throws WorldEditException {
return getBlock(player, id, false); return getBlock(player, id, false);
} }
public Set<BaseBlock> getBlocks(LocalPlayer player, String list, boolean allAllowed, boolean allowNoData) public Set<BaseBlock> getBlocks(LocalPlayer player, String list, boolean allAllowed, boolean allowNoData)
throws DisallowedItemException, UnknownItemException { throws WorldEditException {
String[] items = list.split(","); String[] items = list.split(",");
Set<BaseBlock> blocks = new HashSet<BaseBlock>(); Set<BaseBlock> blocks = new HashSet<BaseBlock>();
for (String id : items) { for (String id : items) {
@ -635,12 +635,12 @@ public class WorldEdit {
} }
public Set<BaseBlock> getBlocks(LocalPlayer player, String list, boolean allAllowed) public Set<BaseBlock> getBlocks(LocalPlayer player, String list, boolean allAllowed)
throws DisallowedItemException, UnknownItemException { throws WorldEditException {
return getBlocks(player, list, allAllowed, false); return getBlocks(player, list, allAllowed, false);
} }
public Set<BaseBlock> getBlocks(LocalPlayer player, String list) public Set<BaseBlock> getBlocks(LocalPlayer player, String list)
throws DisallowedItemException, UnknownItemException { throws WorldEditException {
return getBlocks(player, list, false); return getBlocks(player, list, false);
} }
@ -655,7 +655,7 @@ public class WorldEdit {
* @throws DisallowedItemException * @throws DisallowedItemException
*/ */
public Pattern getBlockPattern(LocalPlayer player, String patternString) public Pattern getBlockPattern(LocalPlayer player, String patternString)
throws UnknownItemException, DisallowedItemException { throws WorldEditException {
String[] items = patternString.split(","); String[] items = patternString.split(",");
@ -804,7 +804,7 @@ public class WorldEdit {
*/ */
public Set<Integer> getBlockIDs(LocalPlayer player, public Set<Integer> getBlockIDs(LocalPlayer player,
String list, boolean allBlocksAllowed) String list, boolean allBlocksAllowed)
throws UnknownItemException, DisallowedItemException { throws WorldEditException {
String[] items = list.split(","); String[] items = list.split(",");
Set<Integer> blocks = new HashSet<Integer>(); Set<Integer> blocks = new HashSet<Integer>();

View File

@ -33,6 +33,7 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.ServerInterface; import com.sk89q.worldedit.ServerInterface;
import com.sk89q.worldedit.UnknownItemException; import com.sk89q.worldedit.UnknownItemException;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.commands.InsufficientArgumentsException; import com.sk89q.worldedit.commands.InsufficientArgumentsException;
import com.sk89q.worldedit.patterns.Pattern; import com.sk89q.worldedit.patterns.Pattern;
@ -156,7 +157,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
* @throws DisallowedItemException * @throws DisallowedItemException
*/ */
public BaseBlock getBlock(String arg, boolean allAllowed) public BaseBlock getBlock(String arg, boolean allAllowed)
throws UnknownItemException, DisallowedItemException { throws WorldEditException {
return controller.getBlock(player, arg, allAllowed); return controller.getBlock(player, arg, allAllowed);
} }
@ -169,7 +170,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
* @throws DisallowedItemException * @throws DisallowedItemException
*/ */
public BaseBlock getBlock(String id) public BaseBlock getBlock(String id)
throws UnknownItemException, DisallowedItemException { throws WorldEditException {
return controller.getBlock(player, id, false); return controller.getBlock(player, id, false);
} }
@ -182,7 +183,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
* @throws DisallowedItemException * @throws DisallowedItemException
*/ */
public Pattern getBlockPattern(String list) public Pattern getBlockPattern(String list)
throws UnknownItemException, DisallowedItemException { throws WorldEditException {
return controller.getBlockPattern(player, list); return controller.getBlockPattern(player, list);
} }
@ -196,7 +197,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
* @throws DisallowedItemException * @throws DisallowedItemException
*/ */
public Set<Integer> getBlockIDs(String list, boolean allBlocksAllowed) public Set<Integer> getBlockIDs(String list, boolean allBlocksAllowed)
throws UnknownItemException, DisallowedItemException { throws WorldEditException {
return controller.getBlockIDs(player, list, allBlocksAllowed); return controller.getBlockIDs(player, list, allBlocksAllowed);
} }