geforkt von Mirrors/FastAsyncWorldEdit
Added a -a flag to /butcher to kill animals. Its now disabled by default.
Dieser Commit ist enthalten in:
Ursprung
bc3a4377ec
Commit
c21c380bba
@ -38,6 +38,7 @@ public abstract class LocalWorld {
|
|||||||
public class KillFlags {
|
public class KillFlags {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +33,7 @@ import org.bukkit.block.Furnace;
|
|||||||
import org.bukkit.block.CreatureSpawner;
|
import org.bukkit.block.CreatureSpawner;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Animals;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.Boat;
|
import org.bukkit.entity.Boat;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -500,6 +501,7 @@ public class BukkitWorld extends LocalWorld {
|
|||||||
public int killMobs(Vector origin, double radius, int flags) {
|
public int killMobs(Vector origin, double radius, int flags) {
|
||||||
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;
|
||||||
|
|
||||||
int num = 0;
|
int num = 0;
|
||||||
double radiusSq = radius * radius;
|
double radiusSq = radius * radius;
|
||||||
@ -511,6 +513,10 @@ public class BukkitWorld extends LocalWorld {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!killAnimals && ent instanceof Animals) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!killPets && ent instanceof Tameable && ((Tameable) ent).isTamed()) {
|
if (!killPets && ent instanceof Tameable && ((Tameable) ent).isTamed()) {
|
||||||
continue; // tamed wolf
|
continue; // tamed wolf
|
||||||
}
|
}
|
||||||
|
@ -345,13 +345,14 @@ public class UtilityCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
aliases = { "butcher" },
|
aliases = { "butcher" },
|
||||||
usage = "[radius]",
|
usage = "[radius]",
|
||||||
flags = "pn",
|
flags = "pna",
|
||||||
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 kill pets.\n" +
|
" -p also kills pets.\n" +
|
||||||
" -n also kill NPCs.",
|
" -n also kills NPCs.\n" +
|
||||||
|
" -a also kills animals.",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 1
|
max = 1
|
||||||
)
|
)
|
||||||
@ -368,6 +369,7 @@ public class UtilityCommands {
|
|||||||
int flags = 0;
|
int flags = 0;
|
||||||
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;
|
||||||
|
|
||||||
int killed = player.getWorld().killMobs(origin, radius, flags);
|
int killed = player.getWorld().killMobs(origin, radius, flags);
|
||||||
player.print("Killed " + killed + " mobs.");
|
player.print("Killed " + killed + " mobs.");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren