3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 11:00:05 +01:00

Added a -a flag to /butcher to kill animals. Its now disabled by default.

Dieser Commit ist enthalten in:
TomyLobo 2011-12-06 07:08:32 +01:00
Ursprung bc3a4377ec
Commit c21c380bba
3 geänderte Dateien mit 12 neuen und 3 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -33,6 +33,7 @@ import org.bukkit.block.Furnace;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.Sign;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Entity;
@ -500,6 +501,7 @@ public class BukkitWorld extends LocalWorld {
public int killMobs(Vector origin, double radius, int flags) {
boolean killPets = (flags & KillFlags.PETS) != 0;
boolean killNPCs = (flags & KillFlags.NPCS) != 0;
boolean killAnimals = (flags & KillFlags.ANIMALS) != 0;
int num = 0;
double radiusSq = radius * radius;
@ -511,6 +513,10 @@ public class BukkitWorld extends LocalWorld {
continue;
}
if (!killAnimals && ent instanceof Animals) {
continue;
}
if (!killPets && ent instanceof Tameable && ((Tameable) ent).isTamed()) {
continue; // tamed wolf
}

Datei anzeigen

@ -345,13 +345,14 @@ public class UtilityCommands {
@Command(
aliases = { "butcher" },
usage = "[radius]",
flags = "pn",
flags = "pna",
desc = "Kill all or nearby mobs",
help =
"Kills nearby mobs, or all mobs if you don't specify a radius.\n" +
"Flags:" +
" -p also kill pets.\n" +
" -n also kill NPCs.",
" -p also kills pets.\n" +
" -n also kills NPCs.\n" +
" -a also kills animals.",
min = 0,
max = 1
)
@ -368,6 +369,7 @@ public class UtilityCommands {
int flags = 0;
if (args.hasFlag('p')) flags |= KillFlags.PETS;
if (args.hasFlag('n')) flags |= KillFlags.NPCS;
if (args.hasFlag('a')) flags |= KillFlags.ANIMALS;
int killed = player.getWorld().killMobs(origin, radius, flags);
player.print("Killed " + killed + " mobs.");