Fix parseFromInput Method for Masks and Patterns When Called via API (#2839)

Explicitly Mask or Pattern in parseFromInput
This commit is contained in:
Zeranny 2024-07-21 08:48:57 +01:00 committed by GitHub
parent 2e1a8f9665
commit d2033d49ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -53,6 +53,7 @@ import com.sk89q.worldedit.extension.factory.parser.mask.NoiseMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.OffsetMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.OffsetMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.RegionMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.RegionMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.SolidMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.SolidMaskParser;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.NoMatchException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
@ -132,6 +133,11 @@ public final class MaskFactory extends AbstractFactory<Mask> {
//FAWE start - rich mask parsing //FAWE start - rich mask parsing
@Override
public Mask parseFromInput(String input, ParserContext context) throws InputParseException {
return super.parseFromInput(input, context);
}
@Override @Override
protected Mask getParsed(final String input, final List<Mask> masks) { protected Mask getParsed(final String input, final List<Mask> masks) {
return switch (masks.size()) { return switch (masks.size()) {

View File

@ -60,7 +60,9 @@ import com.sk89q.worldedit.extension.factory.parser.pattern.RandomPatternParser;
import com.sk89q.worldedit.extension.factory.parser.pattern.RandomStatePatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.RandomStatePatternParser;
import com.sk89q.worldedit.extension.factory.parser.pattern.SingleBlockPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.SingleBlockPatternParser;
import com.sk89q.worldedit.extension.factory.parser.pattern.TypeOrStateApplyingPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.TypeOrStateApplyingPatternParser;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.NoMatchException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.pattern.RandomPattern; import com.sk89q.worldedit.function.pattern.RandomPattern;
import com.sk89q.worldedit.internal.registry.AbstractFactory; import com.sk89q.worldedit.internal.registry.AbstractFactory;
@ -130,6 +132,13 @@ public final class PatternFactory extends AbstractFactory<Pattern> {
register(new VoronoiPatternParser(worldEdit)); register(new VoronoiPatternParser(worldEdit));
} }
//FAWE start - rich pattern parsing
@Override
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException {
return super.parseFromInput(input, context);
}
@Override @Override
protected Pattern getParsed(final String input, final List<Pattern> patterns) { protected Pattern getParsed(final String input, final List<Pattern> patterns) {
switch (patterns.size()) { switch (patterns.size()) {