mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 08:08:34 +00:00
Fixes to BlockMask and "char" masks (#1787)
* If a char mask is successfully created from the full input, return it * Don't double-up adding a block to a BlockMaskBuilder (if adding by regex is successful) - InputParseException is thrown if unsuccessful * Fix optimisation of BlockMask for negation of a single block type - Fixes #1755 * Allow early returning of an optimized MaskIntersection to avoid unnecessary work * Actually allow underscore in isAlphanumericUnd - Fixes #1626 * Replace a few more hard-coded air internal IDs * Don't fail silently if BlockMaskBuilder#addRegex doesn't work when testing all block types * Remove unused import
This commit is contained in:
@ -127,6 +127,9 @@ public class RichMaskParser extends FaweParser<Mask> {
|
||||
case '%', '$', '<', '>', '!' -> {
|
||||
input = input.substring(input.indexOf(char0) + 1);
|
||||
mask = parseFromInput(char0 + "[" + input + "]", context);
|
||||
if (mask != null) {
|
||||
return mask;
|
||||
}
|
||||
}
|
||||
case '#' -> {
|
||||
if (!(input.charAt(1) == '#')) {
|
||||
@ -145,6 +148,10 @@ public class RichMaskParser extends FaweParser<Mask> {
|
||||
try {
|
||||
builder.addRegex(full);
|
||||
} catch (InputParseException ignored) {
|
||||
context.setPreferringWildcard(false);
|
||||
context.setRestricted(false);
|
||||
BaseBlock block = worldEdit.getBlockFactory().parseFromInput(full, context);
|
||||
builder.add(block);
|
||||
} catch (PatternSyntaxException e) {
|
||||
throw new SuggestInputParseException(
|
||||
new NoMatchException(Caption.of("fawe.error.parse.unknown-mask", full,
|
||||
@ -166,10 +173,6 @@ public class RichMaskParser extends FaweParser<Mask> {
|
||||
}
|
||||
);
|
||||
}
|
||||
context.setPreferringWildcard(false);
|
||||
context.setRestricted(false);
|
||||
BaseBlock block = worldEdit.getBlockFactory().parseFromInput(full, context);
|
||||
builder.add(block);
|
||||
mask = builder.build(extent);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user