use of com.sk89q.worldedit.function.mask.BiomeMask in project FastAsyncWorldEdit by IntellectualSites.
the class BiomeMaskParser method parseFromInput.
@Override
public Mask parseFromInput(String input, ParserContext context) throws InputParseException {
if (!input.startsWith("$")) {
return null;
}
// FAWE start - richer parsing
if (input.charAt(1) == '[') {
int end = input.lastIndexOf(']');
if (end == -1) {
return null;
}
input = input.substring(2, end);
} else {
input = input.substring(1);
}
// FAWE end
Set<BiomeType> biomes = new HashSet<>();
// FAWE start - richer parsing
for (String biomeName : Splitter.on(",").split(input)) {
// FAWE end
BiomeType biome = BiomeType.REGISTRY.get(biomeName);
if (biome == null) {
throw new NoMatchException(Caption.of("worldedit.error.unknown-biome", TextComponent.of(biomeName)));
}
biomes.add(biome);
}
return new BiomeMask(context.requireExtent(), biomes);
}
Aggregations