From d7d2d03ee82ae514ae4fbf8a08ff6f8bd84625d4 Mon Sep 17 00:00:00 2001 From: wizjany Date: Wed, 27 Mar 2019 23:36:59 -0400 Subject: [PATCH] Clipboard offset pattern is now #copy@[x,y,z]. Since the parsers were changed around, unescaped commas are parsed as separate blocks now. --- .../parser/pattern/ClipboardPatternParser.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java index 1df80b8d1..f0939ed60 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java @@ -55,15 +55,20 @@ public class ClipboardPatternParser extends InputParser { BlockVector3 offset = BlockVector3.ZERO; if (offsetParts.length == 2) { - String[] offsetSplit = offsetParts[1].split(","); + String coords = offsetParts[1]; + if (coords.length() < 7 // min length of `[x,y,z]` + || coords.charAt(0) != '[' || coords.charAt(coords.length() - 1) != ']') { + throw new InputParseException("Offset specified with @ but no offset given. Use '#copy@[x,y,z]'."); + } + String[] offsetSplit = coords.substring(1, coords.length() - 1).split(","); if (offsetSplit.length != 3) { throw new InputParseException("Clipboard offset needs x,y,z coordinates."); } offset = BlockVector3.at( - Integer.valueOf(offsetSplit[0]), - Integer.valueOf(offsetSplit[1]), - Integer.valueOf(offsetSplit[2]) - ); + Integer.valueOf(offsetSplit[0]), + Integer.valueOf(offsetSplit[1]), + Integer.valueOf(offsetSplit[2]) + ); } if (session != null) {