3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-27 03:12:37 +01:00

The /butcher command no longer kills mobs with a name tag.

This behaviour can be overridden with the new -t flag.
The -f flag encompasses this flag.
Dieser Commit ist enthalten in:
TomyLobo 2014-03-23 19:40:03 +01:00
Ursprung d18a20dafa
Commit 8868aa94d3
4 geänderte Dateien mit 15 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -53,7 +53,8 @@ public abstract class LocalWorld implements World {
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;
}

Datei anzeigen

@ -936,6 +936,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;
@ -967,6 +968,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());
@ -979,6 +984,10 @@ public class BukkitWorld extends LocalWorld {
return num;
}
private static boolean isTagged(LivingEntity ent) {
return ent.getCustomName() != null;
}
/**
* Remove entities in an area.
*

Datei anzeigen

@ -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());

Datei anzeigen

@ -345,7 +345,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" +
@ -355,6 +355,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,
@ -390,6 +391,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