From 1bd8764090bd1e4412e864479fd6514c32285917 Mon Sep 17 00:00:00 2001 From: zml2008 Date: Wed, 28 Mar 2012 11:04:59 -0700 Subject: [PATCH] Corrected flag checks for biome commands --- .../worldedit/commands/BiomeCommands.java | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/commands/BiomeCommands.java b/src/main/java/com/sk89q/worldedit/commands/BiomeCommands.java index c7f49c4ba..d38e518e6 100644 --- a/src/main/java/com/sk89q/worldedit/commands/BiomeCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/BiomeCommands.java @@ -78,7 +78,19 @@ public class BiomeCommands { public void biomeInfo(CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession) throws WorldEditException { - if (!args.hasFlag('l')) { + if (args.hasFlag('t')) { + Vector blockPosition = player.getBlockTrace(300); + if (blockPosition == null) { + player.printError("No block in sight!"); + return; + } + + BiomeType biome = player.getWorld().getBiome(blockPosition.toVector2D()); + player.print("Biome: " + biome.getName()); + } else if (args.hasFlag('p')) { + BiomeType biome = player.getWorld().getBiome(player.getPosition().toVector2D()); + player.print("Biome: " + biome.getName()); + } else { LocalWorld world = player.getWorld(); Region region = session.getSelection(world); Set biomes = new HashSet(); @@ -97,20 +109,6 @@ public class BiomeCommands { for (BiomeType biome : biomes) { player.print(" " + biome.getName()); } - } else { - Vector2D pos; - if (args.hasFlag('t')) { - Vector blockPosition = player.getBlockTrace(300); - if (blockPosition == null) { - player.printError("No block in sight!"); - return; - } - pos = blockPosition.toVector2D(); - } else { - pos = player.getPosition().toVector2D(); - } - BiomeType biome = player.getWorld().getBiome(pos); - player.print("Biome: " + biome.getName()); } } @@ -131,7 +129,11 @@ public class BiomeCommands { EditSession editSession) throws WorldEditException { final BiomeType target = we.getServer().getBiomes().get(args.getString(0)); - if (!args.hasFlag('l')) { + if (args.hasFlag('p')) { + Vector2D pos = player.getPosition().toVector2D(); + player.getWorld().setBiome(pos, target); + player.print("Biome changed to " + target.getName() + " at your current location."); + } else { int affected = 0; LocalWorld world = player.getWorld(); Region region = session.getSelection(world); @@ -144,8 +146,8 @@ public class BiomeCommands { } else { HashSet alreadyVisited = new HashSet(); for (Vector pt : region) { - if (!alreadyVisited.contains((long)pt.getBlockX() << 32 | pt.getBlockZ() & 0xFFFFFFFFL)) { - alreadyVisited.add(((long)pt.getBlockX() << 32 | pt.getBlockZ() & 0xFFFFFFFFL)); + if (!alreadyVisited.contains((long)pt.getBlockX() << 32 | pt.getBlockZ())) { + alreadyVisited.add(((long)pt.getBlockX() << 32 | pt.getBlockZ())); world.setBiome(pt.toVector2D(), target); ++affected; } @@ -153,10 +155,6 @@ public class BiomeCommands { } player.print("Biome changed to " + target.getName() + ". " + affected + " columns affected."); - } else { - Vector2D pos = player.getPosition().toVector2D(); - player.getWorld().setBiome(pos, target); - player.print("Biome changed to " + target.getName() + " at your current location."); } } }