mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-04 11:56:07 +00:00
The /butcher command no longer kills mobs with a name tag.
PR: https://github.com/sk89q/worldedit/pull/292 Conflicts: src/bukkit/java/com/sk89q/worldedit/bukkit/BukkitWorld.java src/main/java/com/sk89q/worldedit/command/BrushCommands.java src/main/java/com/sk89q/worldedit/command/UtilityCommands.java
This commit is contained in:
commit
a3c542b74f
@ -791,6 +791,7 @@ public class BukkitWorld extends LocalWorld {
|
||||
boolean withLightning = (flags & KillFlags.WITH_LIGHTNING) != 0;
|
||||
boolean killGolems = (flags & KillFlags.GOLEMS) != 0;
|
||||
boolean killAmbient = (flags & KillFlags.AMBIENT) != 0;
|
||||
boolean killTagged = (flags & KillFlags.TAGGED) != 0;
|
||||
|
||||
int num = 0;
|
||||
double radiusSq = radius * radius;
|
||||
@ -822,6 +823,10 @@ public class BukkitWorld extends LocalWorld {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!killTagged && isTagged(ent)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (radius < 0 || bukkitOrigin.distanceSquared(ent.getLocation()) <= radiusSq) {
|
||||
if (withLightning) {
|
||||
world.strikeLightningEffect(ent.getLocation());
|
||||
@ -834,6 +839,10 @@ public class BukkitWorld extends LocalWorld {
|
||||
return num;
|
||||
}
|
||||
|
||||
private static boolean isTagged(LivingEntity ent) {
|
||||
return ent.getCustomName() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove entities in an area.
|
||||
*
|
||||
|
@ -45,7 +45,8 @@ public abstract class LocalWorld extends AbstractWorld {
|
||||
public static final int ANIMALS = 1 << 2;
|
||||
public static final int GOLEMS = 1 << 3;
|
||||
public static final int AMBIENT = 1 << 4;
|
||||
public static final int FRIENDLY = PETS | NPCS | ANIMALS | GOLEMS | AMBIENT;
|
||||
public static final int TAGGED = 1 << 5;
|
||||
public static final int FRIENDLY = PETS | NPCS | ANIMALS | GOLEMS | AMBIENT | TAGGED;
|
||||
public static final int WITH_LIGHTNING = 1 << 20;
|
||||
|
||||
private KillFlags() {
|
||||
|
@ -281,6 +281,7 @@ public class BrushCommands {
|
||||
flags.or(KillFlags.GOLEMS , flagString.contains("g"), "worldedit.butcher.golems");
|
||||
flags.or(KillFlags.ANIMALS , flagString.contains("a"), "worldedit.butcher.animals");
|
||||
flags.or(KillFlags.AMBIENT , flagString.contains("b"), "worldedit.butcher.ambient");
|
||||
flags.or(KillFlags.TAGGED , flagString.contains("t"), "worldedit.butcher.tagged");
|
||||
flags.or(KillFlags.WITH_LIGHTNING, flagString.contains("l"), "worldedit.butcher.lightning");
|
||||
}
|
||||
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
||||
|
@ -346,7 +346,7 @@ public class UtilityCommands {
|
||||
@Command(
|
||||
aliases = { "butcher" },
|
||||
usage = "[radius]",
|
||||
flags = "plangbf",
|
||||
flags = "plangbtf",
|
||||
desc = "Kill all or nearby mobs",
|
||||
help =
|
||||
"Kills nearby mobs, based on radius, if none is given uses default in configuration.\n" +
|
||||
@ -356,6 +356,7 @@ public class UtilityCommands {
|
||||
" -g also kills Golems.\n" +
|
||||
" -a also kills animals.\n" +
|
||||
" -b also kills ambient mobs.\n" +
|
||||
" -t also kills mobs with name tags.\n" +
|
||||
" -f compounds all previous flags.\n" +
|
||||
" -l strikes lightning on each killed mob.",
|
||||
min = 0,
|
||||
@ -391,6 +392,7 @@ public class UtilityCommands {
|
||||
flags.or(KillFlags.GOLEMS , args.hasFlag('g'), "worldedit.butcher.golems");
|
||||
flags.or(KillFlags.ANIMALS , args.hasFlag('a'), "worldedit.butcher.animals");
|
||||
flags.or(KillFlags.AMBIENT , args.hasFlag('b'), "worldedit.butcher.ambient");
|
||||
flags.or(KillFlags.TAGGED , args.hasFlag('t'), "worldedit.butcher.tagged");
|
||||
flags.or(KillFlags.WITH_LIGHTNING, args.hasFlag('l'), "worldedit.butcher.lightning");
|
||||
// If you add flags here, please add them to com.sk89q.worldedit.commands.BrushCommands.butcherBrush() as well
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user