mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Add workaround for when expressions are parsed in masks/patterns where '&&' is used
Fixes #1517
This commit is contained in:
parent
0408cd0575
commit
722c411219
@ -33,12 +33,14 @@ public abstract class FaweParser<T> extends InputParser<T> implements AliasedPar
|
||||
List<String> inputs = new ArrayList<>();
|
||||
List<Boolean> and = new ArrayList<>();
|
||||
int last = 0;
|
||||
outer:
|
||||
boolean expression = false;
|
||||
for (int i = 0; i < toParse.length(); i++) {
|
||||
char c = toParse.charAt(i);
|
||||
switch (c) {
|
||||
case ',':
|
||||
case '&':
|
||||
case ',', '&' -> {
|
||||
if (expression) {
|
||||
continue;
|
||||
}
|
||||
String result = toParse.substring(last, i);
|
||||
if (!result.isEmpty()) {
|
||||
inputs.add(result);
|
||||
@ -47,8 +49,9 @@ public abstract class FaweParser<T> extends InputParser<T> implements AliasedPar
|
||||
throw new InputParseException(Caption.of("fawe.error.parse.invalid-dangling-character", c));
|
||||
}
|
||||
last = i + 1;
|
||||
continue outer;
|
||||
default:
|
||||
}
|
||||
case '=' -> expression = true;
|
||||
default -> {
|
||||
if (c == '[') {
|
||||
int next = StringMan.findMatchingBracket(toParse, i);
|
||||
if (next != -1) {
|
||||
@ -57,7 +60,9 @@ public abstract class FaweParser<T> extends InputParser<T> implements AliasedPar
|
||||
toParse += "]";
|
||||
i = toParse.length();
|
||||
}
|
||||
expression = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
inputs.add(toParse.substring(last));
|
||||
|
Loading…
Reference in New Issue
Block a user