Few fixes

This commit is contained in:
Matthew Miller 2018-12-23 21:24:58 +10:00
parent 645fd682b6
commit 1d5e9b7d04
3 changed files with 15 additions and 15 deletions

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.mask; package com.sk89q.worldedit.extension.factory.parser.mask;
import com.google.common.base.Splitter;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
@ -48,10 +49,9 @@ public class BiomeMaskParser extends InputParser<Mask> {
} }
Set<BaseBiome> biomes = new HashSet<>(); Set<BaseBiome> biomes = new HashSet<>();
String[] biomesList = input.substring(1).split(",");
BiomeRegistry biomeRegistry = worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); BiomeRegistry biomeRegistry = worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
List<BaseBiome> knownBiomes = biomeRegistry.getBiomes(); List<BaseBiome> knownBiomes = biomeRegistry.getBiomes();
for (String biomeName : biomesList) { for (String biomeName : Splitter.on(",").split(input.substring(1))) {
BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry); BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry);
if (biome == null) { if (biome == null) {
throw new InputParseException("Unknown biome '" + biomeName + '\''); throw new InputParseException("Unknown biome '" + biomeName + '\'');

View File

@ -38,7 +38,10 @@ public class BlockCategoryMaskParser extends InputParser<Mask> {
@Override @Override
public Mask parseFromInput(String input, ParserContext context) throws InputParseException { public Mask parseFromInput(String input, ParserContext context) throws InputParseException {
if (input.startsWith("##")) { if (!input.startsWith("##")) {
return null;
}
Extent extent = Request.request().getEditSession(); Extent extent = Request.request().getEditSession();
// This means it's a tag mask. // This means it's a tag mask.
@ -49,7 +52,4 @@ public class BlockCategoryMaskParser extends InputParser<Mask> {
return new BlockCategoryMask(extent, category); return new BlockCategoryMask(extent, category);
} }
} }
return null;
}
} }

View File

@ -19,11 +19,11 @@
package com.sk89q.worldedit.internal.registry; package com.sk89q.worldedit.internal.registry;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -48,6 +48,6 @@ public abstract class InputParser<E> {
* @return a list of suggestions * @return a list of suggestions
*/ */
public List<String> getSuggestions() { public List<String> getSuggestions() {
return Lists.newArrayList(); return Collections.emptyList();
} }
} }