mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
fix: require extent for mask parsing (#1373)
(cherry picked from commit 1ced57c301bc1c98667a260fd8b6aa128675f0d2)
This commit is contained in:
parent
c0bfe06e4b
commit
39439fb405
@ -77,6 +77,6 @@ public class BiomeMaskParser extends InputParser<Mask> {
|
||||
biomes.add(biome);
|
||||
}
|
||||
|
||||
return Masks.asMask(new BiomeMask2D(context.getExtent(), biomes));
|
||||
return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes));
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class BlockCategoryMaskParser extends InputParser<Mask> {
|
||||
if (category == null) {
|
||||
throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\'');
|
||||
} else {
|
||||
return new BlockCategoryMask(context.getExtent(), category);
|
||||
return new BlockCategoryMask(context.requireExtent(), category);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class BlockStateMaskParser extends InputParser<Mask> {
|
||||
boolean strict = input.charAt(1) == '=';
|
||||
String states = input.substring(2 + (strict ? 1 : 0), input.length() - 1);
|
||||
try {
|
||||
return new BlockStateMask(context.getExtent(),
|
||||
return new BlockStateMask(context.requireExtent(),
|
||||
Splitter.on(',').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(states),
|
||||
strict);
|
||||
} catch (Exception e) {
|
||||
|
@ -55,8 +55,8 @@ public class BlocksMaskParser extends InputParser<Mask> {
|
||||
if (holders.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return new BlockMask(context.getExtent(), holders);
|
||||
} catch (InputParseException e) {
|
||||
return new BlockMask(context.requireExtent(), holders);
|
||||
} catch (NoMatchException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -42,7 +43,7 @@ public class ExistingMaskParser extends SimpleInputParser<Mask> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mask parseFromSimpleInput(String input, ParserContext context) {
|
||||
return new ExistingBlockMask(context.getExtent());
|
||||
public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException {
|
||||
return new ExistingBlockMask(context.requireExtent());
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class ExpressionMaskParser extends InputParser<Mask> {
|
||||
try {
|
||||
Expression exp = Expression.compile(input.substring(1), "x", "y", "z");
|
||||
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(
|
||||
context.getExtent(), Vector3.ONE, Vector3.ZERO);
|
||||
context.requireExtent(), Vector3.ONE, Vector3.ZERO);
|
||||
exp.setEnvironment(env);
|
||||
if (context.getActor() != null) {
|
||||
SessionOwner owner = context.getActor();
|
||||
|
@ -61,7 +61,7 @@ public class OffsetMaskParser extends InputParser<Mask> {
|
||||
if (input.length() > 1) {
|
||||
submask = worldEdit.getMaskFactory().parseFromInput(input.substring(1), context);
|
||||
} else {
|
||||
submask = new ExistingBlockMask(context.getExtent());
|
||||
submask = new ExistingBlockMask(context.requireExtent());
|
||||
}
|
||||
OffsetMask offsetMask = new OffsetMask(submask, BlockVector3.at(0, firstChar == '>' ? -1 : 1, 0));
|
||||
return new MaskIntersection(offsetMask, Masks.negate(submask));
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
@ -42,7 +43,7 @@ public class SolidMaskParser extends SimpleInputParser<Mask> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mask parseFromSimpleInput(String input, ParserContext context) {
|
||||
return new SolidBlockMask(context.getExtent());
|
||||
public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException {
|
||||
return new SolidBlockMask(context.requireExtent());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user