From 7b0570f714a4bd42de9861409f06a6aad9bcbfbe Mon Sep 17 00:00:00 2001 From: zml2008 Date: Sat, 26 May 2012 10:55:14 -0700 Subject: [PATCH] Correctly nullcheck biome types in //setbiome Biome changing is no longer supported in SpoutAPI, will reimplement when I have time --- .../java/com/sk89q/worldedit/commands/BiomeCommands.java | 5 +++++ src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sk89q/worldedit/commands/BiomeCommands.java b/src/main/java/com/sk89q/worldedit/commands/BiomeCommands.java index d38e518e6..784eb5bf1 100644 --- a/src/main/java/com/sk89q/worldedit/commands/BiomeCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/BiomeCommands.java @@ -129,6 +129,11 @@ public class BiomeCommands { EditSession editSession) throws WorldEditException { final BiomeType target = we.getServer().getBiomes().get(args.getString(0)); + if (target == null) { + player.printError("Biome '" + args.getString(0) + "' does not exist!"); + return; + } + if (args.hasFlag('p')) { Vector2D pos = player.getPosition().toVector2D(); player.getWorld().setBiome(pos, target); diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java b/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java index 695daa217..26dc842fc 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java @@ -213,7 +213,8 @@ public class SpoutWorld extends LocalWorld { if (biome instanceof SpoutBiomeType && world.getGenerator() instanceof BiomeGenerator) { BiomeGenerator gen = (BiomeGenerator) world.getGenerator(); - gen.setBiome(new Vector3(pt.getBlockX(), 0, pt.getBlockZ()), ((SpoutBiomeType) biome).getSpoutBiome()); + throw new UnsupportedOperationException("Biome changing is not yet supported in Spout"); + //gen.setBiome(new Vector3(pt.getBlockX(), 0, pt.getBlockZ()), ((SpoutBiomeType) biome).getSpoutBiome()); } }