mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 17:57:38 +00:00
Added a -l flag to /butcher, which spawns fake lightning on all killed entities.
This commit is contained in:
parent
09a92fa76c
commit
050442fac3
@ -39,6 +39,7 @@ public abstract class LocalWorld {
|
||||
public static final int PETS = 1 << 0;
|
||||
public static final int NPCS = 1 << 1;
|
||||
public static final int ANIMALS = 1 << 2;
|
||||
public static final int WITH_LIGHTNING = 1 << 20;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -475,6 +475,7 @@ public class BukkitWorld extends LocalWorld {
|
||||
boolean killPets = (flags & KillFlags.PETS) != 0;
|
||||
boolean killNPCs = (flags & KillFlags.NPCS) != 0;
|
||||
boolean killAnimals = (flags & KillFlags.ANIMALS) != 0;
|
||||
boolean withLightning = (flags & KillFlags.WITH_LIGHTNING) != 0;
|
||||
|
||||
int num = 0;
|
||||
double radiusSq = radius * radius;
|
||||
@ -502,6 +503,9 @@ public class BukkitWorld extends LocalWorld {
|
||||
} catch (ClassNotFoundException e) {}
|
||||
|
||||
if (radius < 0 || bukkitOrigin.distanceSquared(ent.getLocation()) <= radiusSq) {
|
||||
if (withLightning) {
|
||||
world.strikeLightningEffect(ent.getLocation());
|
||||
}
|
||||
ent.remove();
|
||||
++num;
|
||||
}
|
||||
|
@ -346,14 +346,15 @@ public class UtilityCommands {
|
||||
@Command(
|
||||
aliases = { "butcher" },
|
||||
usage = "[radius]",
|
||||
flags = "pna",
|
||||
flags = "plan",
|
||||
desc = "Kill all or nearby mobs",
|
||||
help =
|
||||
"Kills nearby mobs, or all mobs if you don't specify a radius.\n" +
|
||||
"Flags:" +
|
||||
" -p also kills pets.\n" +
|
||||
" -n also kills NPCs.\n" +
|
||||
" -a also kills animals.",
|
||||
" -a also kills animals.\n" +
|
||||
" -l strikes lightning on each killed mob.",
|
||||
min = 0,
|
||||
max = 1
|
||||
)
|
||||
@ -369,6 +370,7 @@ public class UtilityCommands {
|
||||
if (args.hasFlag('p')) flags |= KillFlags.PETS;
|
||||
if (args.hasFlag('n')) flags |= KillFlags.NPCS;
|
||||
if (args.hasFlag('a')) flags |= KillFlags.ANIMALS;
|
||||
if (args.hasFlag('l') && player.hasPermission("worldedit.butcher.lightning")) flags |= KillFlags.WITH_LIGHTNING;
|
||||
|
||||
int killed;
|
||||
if (player.isPlayer()) {
|
||||
|
Loading…
Reference in New Issue
Block a user