From 93a48bbb5508db28ec49be667789cefe5bcf7db3 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 28 Jun 2014 17:37:13 -0700 Subject: [PATCH] Handle NoMatchException in WorldEditBinding. --- .../internal/command/WorldEditBinding.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java index 9d5210496..ed29e8fb5 100644 --- a/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java +++ b/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java @@ -23,6 +23,7 @@ import com.sk89q.worldedit.*; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.function.mask.Mask; @@ -160,7 +161,11 @@ public class WorldEditBinding extends BindingHelper { parserContext.setWorld(((Entity) actor).getWorld()); } parserContext.setSession(worldEdit.getSessionManager().get(actor)); - return worldEdit.getBlockRegistry().parseFromInput(context.next(), parserContext); + try { + return worldEdit.getBlockRegistry().parseFromInput(context.next(), parserContext); + } catch (NoMatchException e) { + throw new ParameterException(e.getMessage(), e); + } } /** @@ -182,7 +187,11 @@ public class WorldEditBinding extends BindingHelper { parserContext.setWorld(((Entity) actor).getWorld()); } parserContext.setSession(worldEdit.getSessionManager().get(actor)); - return worldEdit.getPatternRegistry().parseFromInput(context.next(), parserContext); + try { + return worldEdit.getPatternRegistry().parseFromInput(context.next(), parserContext); + } catch (NoMatchException e) { + throw new ParameterException(e.getMessage(), e); + } } /** @@ -204,7 +213,11 @@ public class WorldEditBinding extends BindingHelper { parserContext.setWorld(((Entity) actor).getWorld()); } parserContext.setSession(worldEdit.getSessionManager().get(actor)); - return worldEdit.getMaskRegistry().parseFromInput(context.next(), parserContext); + try { + return worldEdit.getMaskRegistry().parseFromInput(context.next(), parserContext); + } catch (NoMatchException e) { + throw new ParameterException(e.getMessage(), e); + } } /**