3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 10:30:04 +01:00

Corrected flag checks for biome commands

Dieser Commit ist enthalten in:
zml2008 2012-03-28 11:04:59 -07:00
Ursprung 5e8f50699d
Commit 1bd8764090

Datei anzeigen

@ -78,7 +78,19 @@ public class BiomeCommands {
public void biomeInfo(CommandContext args, LocalSession session, LocalPlayer player, public void biomeInfo(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException { 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(); LocalWorld world = player.getWorld();
Region region = session.getSelection(world); Region region = session.getSelection(world);
Set<BiomeType> biomes = new HashSet<BiomeType>(); Set<BiomeType> biomes = new HashSet<BiomeType>();
@ -97,20 +109,6 @@ public class BiomeCommands {
for (BiomeType biome : biomes) { for (BiomeType biome : biomes) {
player.print(" " + biome.getName()); 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 { EditSession editSession) throws WorldEditException {
final BiomeType target = we.getServer().getBiomes().get(args.getString(0)); 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; int affected = 0;
LocalWorld world = player.getWorld(); LocalWorld world = player.getWorld();
Region region = session.getSelection(world); Region region = session.getSelection(world);
@ -144,8 +146,8 @@ public class BiomeCommands {
} else { } else {
HashSet<Long> alreadyVisited = new HashSet<Long>(); HashSet<Long> alreadyVisited = new HashSet<Long>();
for (Vector pt : region) { for (Vector pt : region) {
if (!alreadyVisited.contains((long)pt.getBlockX() << 32 | pt.getBlockZ() & 0xFFFFFFFFL)) { if (!alreadyVisited.contains((long)pt.getBlockX() << 32 | pt.getBlockZ())) {
alreadyVisited.add(((long)pt.getBlockX() << 32 | pt.getBlockZ() & 0xFFFFFFFFL)); alreadyVisited.add(((long)pt.getBlockX() << 32 | pt.getBlockZ()));
world.setBiome(pt.toVector2D(), target); world.setBiome(pt.toVector2D(), target);
++affected; ++affected;
} }
@ -153,10 +155,6 @@ public class BiomeCommands {
} }
player.print("Biome changed to " + target.getName() + ". " + affected + " columns affected."); 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.");
} }
} }
} }