Fix plot biomes.

When migrating to the WorldEdit Biome types, code was not altered to account for these changes. This lead to configuration parsing breaking, and the `/plot setbiome` command no longer functioning. This fixes #2599.
This commit is contained in:
Alexander Söderberg 2019-12-20 17:37:48 +01:00
parent ccc7b0ec65
commit c6e36fd70e
2 changed files with 16 additions and 18 deletions

View File

@ -15,20 +15,11 @@ import com.sk89q.worldedit.world.biome.BiomeTypes;
requiredType = RequiredType.NONE) public class Biome extends SetCommand {
@Override public boolean set(final PlotPlayer player, final Plot plot, final String value) {
BiomeType biome = null;
try {
BiomeType biome = BiomeTypes.get(value);
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
return false;
}
plot.addRunning();
plot.setBiome(biome, () -> {
plot.removeRunning();
MainUtil
.sendMessage(player, Captions.BIOME_SET_TO.getTranslated() + value.toLowerCase());
});
return true;
} catch (IllegalStateException ignore) {
biome = BiomeTypes.get(value.toLowerCase());
} catch (final Exception ignore) {}
if (biome == null) {
String biomes = StringMan
.join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
Captions.NEED_BIOME.send(player);
@ -36,5 +27,16 @@ import com.sk89q.worldedit.world.biome.BiomeTypes;
Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes);
return false;
}
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
return false;
}
plot.addRunning();
plot.setBiome(biome, () -> {
plot.removeRunning();
MainUtil
.sendMessage(player, Captions.BIOME_SET_TO.getTranslated() + value.toLowerCase());
});
return true;
}
}

View File

@ -1,8 +1,6 @@
package com.github.intellectualsites.plotsquared.plot.config;
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes;
@ -10,8 +8,6 @@ import com.sk89q.worldedit.world.block.BlockState;
import lombok.Getter;
import lombok.NonNull;
import java.util.regex.Matcher;
/**
* Main Configuration Utility
*/
@ -53,7 +49,7 @@ public class Configuration {
@Override public BiomeType parseString(String string) {
if (validateValue(string)) {
return BiomeTypes.get(string.toUpperCase());
return BiomeTypes.get(string.toLowerCase());
}
return BiomeTypes.FOREST;
}