Permalink
Browse files

Few fixes

  • Loading branch information...
me4502 committed Dec 23, 2018
1 parent 645fd68 commit 1d5e9b7d04d3e9db20cc9f22930d993c9bfa350d
@@ -19,6 +19,7 @@

package com.sk89q.worldedit.extension.factory.parser.mask;

import com.google.common.base.Splitter;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
@@ -48,10 +49,9 @@ public Mask parseFromInput(String input, ParserContext context) throws InputPars
}

Set<BaseBiome> biomes = new HashSet<>();
String[] biomesList = input.substring(1).split(",");
BiomeRegistry biomeRegistry = worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
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);
if (biome == null) {
throw new InputParseException("Unknown biome '" + biomeName + '\'');
@@ -38,18 +38,18 @@ public BlockCategoryMaskParser(WorldEdit worldEdit) {

@Override
public Mask parseFromInput(String input, ParserContext context) throws InputParseException {
if (input.startsWith("##")) {
Extent extent = Request.request().getEditSession();

// This means it's a tag mask.
BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase());
if (category == null) {
throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\'');
} else {
return new BlockCategoryMask(extent, category);
}
if (!input.startsWith("##")) {
return null;
}

return null;
Extent extent = Request.request().getEditSession();

// This means it's a tag mask.
BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase());
if (category == null) {
throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\'');
} else {
return new BlockCategoryMask(extent, category);
}
}
}
@@ -19,11 +19,11 @@

package com.sk89q.worldedit.internal.registry;

import com.google.common.collect.Lists;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;

import java.util.Collections;
import java.util.List;

/**
@@ -48,6 +48,6 @@ public InputParser(WorldEdit worldEdit) {
* @return a list of suggestions
*/
public List<String> getSuggestions() {
return Lists.newArrayList();
return Collections.emptyList();
}
}

0 comments on commit 1d5e9b7

Please sign in to comment.