geforkt von Mirrors/FastAsyncWorldEdit
Added butcher flag for ambient mobs.
Dieser Commit ist enthalten in:
Ursprung
e728445383
Commit
6c189c4ff9
@ -51,7 +51,8 @@ public abstract class LocalWorld implements World {
|
|||||||
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 GOLEMS = 1 << 3;
|
public static final int GOLEMS = 1 << 3;
|
||||||
public static final int FRIENDLY = PETS | NPCS | ANIMALS | GOLEMS;
|
public static final int AMBIENT = 1 << 4;
|
||||||
|
public static final int FRIENDLY = PETS | NPCS | ANIMALS | GOLEMS | AMBIENT;
|
||||||
public static final int WITH_LIGHTNING = 1 << 20;
|
public static final int WITH_LIGHTNING = 1 << 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +43,13 @@ import org.bukkit.block.CreatureSpawner;
|
|||||||
import org.bukkit.block.Furnace;
|
import org.bukkit.block.Furnace;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Ambient;
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
import org.bukkit.entity.Boat;
|
import org.bukkit.entity.Boat;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.ExperienceOrb;
|
import org.bukkit.entity.ExperienceOrb;
|
||||||
import org.bukkit.entity.FallingBlock;
|
import org.bukkit.entity.FallingBlock;
|
||||||
|
import org.bukkit.entity.Golem;
|
||||||
import org.bukkit.entity.Hanging;
|
import org.bukkit.entity.Hanging;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
@ -58,6 +60,7 @@ import org.bukkit.entity.Painting;
|
|||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
|
import org.bukkit.entity.Villager;
|
||||||
import org.bukkit.inventory.DoubleChestInventory;
|
import org.bukkit.inventory.DoubleChestInventory;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -618,6 +621,7 @@ public class BukkitWorld extends LocalWorld {
|
|||||||
boolean killAnimals = (flags & KillFlags.ANIMALS) != 0;
|
boolean killAnimals = (flags & KillFlags.ANIMALS) != 0;
|
||||||
boolean withLightning = (flags & KillFlags.WITH_LIGHTNING) != 0;
|
boolean withLightning = (flags & KillFlags.WITH_LIGHTNING) != 0;
|
||||||
boolean killGolems = (flags & KillFlags.GOLEMS) != 0;
|
boolean killGolems = (flags & KillFlags.GOLEMS) != 0;
|
||||||
|
boolean killAmbient = (flags & KillFlags.AMBIENT) != 0;
|
||||||
|
|
||||||
int num = 0;
|
int num = 0;
|
||||||
double radiusSq = radius * radius;
|
double radiusSq = radius * radius;
|
||||||
@ -634,22 +638,20 @@ public class BukkitWorld extends LocalWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!killPets && ent instanceof Tameable && ((Tameable) ent).isTamed()) {
|
if (!killPets && ent instanceof Tameable && ((Tameable) ent).isTamed()) {
|
||||||
continue; // tamed wolf
|
continue; // tamed pet
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (!killGolems && ent instanceof Golem) {
|
||||||
// Temporary solution to fix Golems being butchered.
|
continue;
|
||||||
if (!killGolems && Class.forName("org.bukkit.entity.Golem").isAssignableFrom(ent.getClass())) {
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} catch (ClassNotFoundException e) {}
|
|
||||||
|
|
||||||
try {
|
if (!killNPCs && ent instanceof Villager) {
|
||||||
// Temporary solution until org.bukkit.entity.NPC is widely deployed.
|
continue;
|
||||||
if (!killNPCs && Class.forName("org.bukkit.entity.NPC").isAssignableFrom(ent.getClass())) {
|
}
|
||||||
continue;
|
|
||||||
}
|
if (!killAmbient && ent instanceof Ambient) {
|
||||||
} catch (ClassNotFoundException e) {}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (radius < 0 || bukkitOrigin.distanceSquared(ent.getLocation()) <= radiusSq) {
|
if (radius < 0 || bukkitOrigin.distanceSquared(ent.getLocation()) <= radiusSq) {
|
||||||
if (withLightning) {
|
if (withLightning) {
|
||||||
|
@ -356,7 +356,7 @@ public class UtilityCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
aliases = { "butcher" },
|
aliases = { "butcher" },
|
||||||
usage = "[radius]",
|
usage = "[radius]",
|
||||||
flags = "plangf",
|
flags = "plangbf",
|
||||||
desc = "Kill all or nearby mobs",
|
desc = "Kill all or nearby mobs",
|
||||||
help =
|
help =
|
||||||
"Kills nearby mobs, based on radius, if none is given uses default in configuration.\n" +
|
"Kills nearby mobs, based on radius, if none is given uses default in configuration.\n" +
|
||||||
@ -365,6 +365,7 @@ public class UtilityCommands {
|
|||||||
" -n also kills NPCs.\n" +
|
" -n also kills NPCs.\n" +
|
||||||
" -g also kills Golems.\n" +
|
" -g also kills Golems.\n" +
|
||||||
" -a also kills animals.\n" +
|
" -a also kills animals.\n" +
|
||||||
|
" -b also kills ambient mobs.\n" +
|
||||||
" -f compounds all previous flags.\n" +
|
" -f compounds all previous flags.\n" +
|
||||||
" -l strikes lightning on each killed mob.",
|
" -l strikes lightning on each killed mob.",
|
||||||
min = 0,
|
min = 0,
|
||||||
@ -399,6 +400,7 @@ public class UtilityCommands {
|
|||||||
flags.or(KillFlags.NPCS , args.hasFlag('n'), "worldedit.butcher.npcs");
|
flags.or(KillFlags.NPCS , args.hasFlag('n'), "worldedit.butcher.npcs");
|
||||||
flags.or(KillFlags.GOLEMS , args.hasFlag('g'), "worldedit.butcher.golems");
|
flags.or(KillFlags.GOLEMS , args.hasFlag('g'), "worldedit.butcher.golems");
|
||||||
flags.or(KillFlags.ANIMALS , args.hasFlag('a'), "worldedit.butcher.animals");
|
flags.or(KillFlags.ANIMALS , args.hasFlag('a'), "worldedit.butcher.animals");
|
||||||
|
flags.or(KillFlags.AMBIENT , args.hasFlag('b'), "worldedit.butcher.ambient");
|
||||||
flags.or(KillFlags.WITH_LIGHTNING, args.hasFlag('l'), "worldedit.butcher.lightning");
|
flags.or(KillFlags.WITH_LIGHTNING, args.hasFlag('l'), "worldedit.butcher.lightning");
|
||||||
|
|
||||||
int killed;
|
int killed;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren