Added a -l flag to /butcher, which spawns fake lightning on all killed entities.

Dieser Commit ist enthalten in:
TomyLobo 2011-12-21 18:10:34 +01:00
Ursprung 09a92fa76c
Commit 050442fac3
3 geänderte Dateien mit 9 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -39,6 +39,7 @@ public abstract class LocalWorld {
public static final int PETS = 1 << 0; public static final int PETS = 1 << 0;
public static final int NPCS = 1 << 1; public static final int NPCS = 1 << 1;
public static final int ANIMALS = 1 << 2; public static final int ANIMALS = 1 << 2;
public static final int WITH_LIGHTNING = 1 << 20;
} }
/** /**

Datei anzeigen

@ -475,6 +475,7 @@ public class BukkitWorld extends LocalWorld {
boolean killPets = (flags & KillFlags.PETS) != 0; boolean killPets = (flags & KillFlags.PETS) != 0;
boolean killNPCs = (flags & KillFlags.NPCS) != 0; boolean killNPCs = (flags & KillFlags.NPCS) != 0;
boolean killAnimals = (flags & KillFlags.ANIMALS) != 0; boolean killAnimals = (flags & KillFlags.ANIMALS) != 0;
boolean withLightning = (flags & KillFlags.WITH_LIGHTNING) != 0;
int num = 0; int num = 0;
double radiusSq = radius * radius; double radiusSq = radius * radius;
@ -502,6 +503,9 @@ public class BukkitWorld extends LocalWorld {
} catch (ClassNotFoundException e) {} } catch (ClassNotFoundException e) {}
if (radius < 0 || bukkitOrigin.distanceSquared(ent.getLocation()) <= radiusSq) { if (radius < 0 || bukkitOrigin.distanceSquared(ent.getLocation()) <= radiusSq) {
if (withLightning) {
world.strikeLightningEffect(ent.getLocation());
}
ent.remove(); ent.remove();
++num; ++num;
} }

Datei anzeigen

@ -346,14 +346,15 @@ public class UtilityCommands {
@Command( @Command(
aliases = { "butcher" }, aliases = { "butcher" },
usage = "[radius]", usage = "[radius]",
flags = "pna", flags = "plan",
desc = "Kill all or nearby mobs", desc = "Kill all or nearby mobs",
help = help =
"Kills nearby mobs, or all mobs if you don't specify a radius.\n" + "Kills nearby mobs, or all mobs if you don't specify a radius.\n" +
"Flags:" + "Flags:" +
" -p also kills pets.\n" + " -p also kills pets.\n" +
" -n also kills NPCs.\n" + " -n also kills NPCs.\n" +
" -a also kills animals.", " -a also kills animals.\n" +
" -l strikes lightning on each killed mob.",
min = 0, min = 0,
max = 1 max = 1
) )
@ -369,6 +370,7 @@ public class UtilityCommands {
if (args.hasFlag('p')) flags |= KillFlags.PETS; if (args.hasFlag('p')) flags |= KillFlags.PETS;
if (args.hasFlag('n')) flags |= KillFlags.NPCS; if (args.hasFlag('n')) flags |= KillFlags.NPCS;
if (args.hasFlag('a')) flags |= KillFlags.ANIMALS; if (args.hasFlag('a')) flags |= KillFlags.ANIMALS;
if (args.hasFlag('l') && player.hasPermission("worldedit.butcher.lightning")) flags |= KillFlags.WITH_LIGHTNING;
int killed; int killed;
if (player.isPlayer()) { if (player.isPlayer()) {