From 5692ec54dd05550dca41a2ec30c20582e2bb9211 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Tue, 16 Nov 2021 14:32:25 +0000 Subject: [PATCH] Parse with square brackets after a % modifier - Fixes #1409 --- .../factory/parser/pattern/RichPatternParser.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java index 8c93cb0e4..3dabc70c0 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java @@ -114,10 +114,14 @@ public class RichPatternParser extends FaweParser { chance = Expression.compile(command.substring(0, percentIndex)).evaluate(); String value = command.substring(percentIndex + 1); if (!entry.getValue().isEmpty()) { - if (!value.isEmpty()) { - value += " "; + boolean addBrackets = !value.isEmpty(); + if (addBrackets) { + value += "["; } value += StringMan.join(entry.getValue(), " "); + if (addBrackets) { + value += "]"; + } } pattern = parseFromInput(value, context); } else { // legacy block pattern