Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-26 11:00:04 +01: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
Dieser Commit ist enthalten in:
Commit
a3c542b74f
@ -791,6 +791,7 @@ public class BukkitWorld extends LocalWorld {
|
|||||||
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;
|
boolean killAmbient = (flags & KillFlags.AMBIENT) != 0;
|
||||||
|
boolean killTagged = (flags & KillFlags.TAGGED) != 0;
|
||||||
|
|
||||||
int num = 0;
|
int num = 0;
|
||||||
double radiusSq = radius * radius;
|
double radiusSq = radius * radius;
|
||||||
@ -822,6 +823,10 @@ public class BukkitWorld extends LocalWorld {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!killTagged && isTagged(ent)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (radius < 0 || bukkitOrigin.distanceSquared(ent.getLocation()) <= radiusSq) {
|
if (radius < 0 || bukkitOrigin.distanceSquared(ent.getLocation()) <= radiusSq) {
|
||||||
if (withLightning) {
|
if (withLightning) {
|
||||||
world.strikeLightningEffect(ent.getLocation());
|
world.strikeLightningEffect(ent.getLocation());
|
||||||
@ -834,6 +839,10 @@ public class BukkitWorld extends LocalWorld {
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isTagged(LivingEntity ent) {
|
||||||
|
return ent.getCustomName() != null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove entities in an area.
|
* 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 ANIMALS = 1 << 2;
|
||||||
public static final int GOLEMS = 1 << 3;
|
public static final int GOLEMS = 1 << 3;
|
||||||
public static final int AMBIENT = 1 << 4;
|
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;
|
public static final int WITH_LIGHTNING = 1 << 20;
|
||||||
|
|
||||||
private KillFlags() {
|
private KillFlags() {
|
||||||
|
@ -281,6 +281,7 @@ public class BrushCommands {
|
|||||||
flags.or(KillFlags.GOLEMS , flagString.contains("g"), "worldedit.butcher.golems");
|
flags.or(KillFlags.GOLEMS , flagString.contains("g"), "worldedit.butcher.golems");
|
||||||
flags.or(KillFlags.ANIMALS , flagString.contains("a"), "worldedit.butcher.animals");
|
flags.or(KillFlags.ANIMALS , flagString.contains("a"), "worldedit.butcher.animals");
|
||||||
flags.or(KillFlags.AMBIENT , flagString.contains("b"), "worldedit.butcher.ambient");
|
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");
|
flags.or(KillFlags.WITH_LIGHTNING, flagString.contains("l"), "worldedit.butcher.lightning");
|
||||||
}
|
}
|
||||||
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
||||||
|
@ -346,7 +346,7 @@ public class UtilityCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
aliases = { "butcher" },
|
aliases = { "butcher" },
|
||||||
usage = "[radius]",
|
usage = "[radius]",
|
||||||
flags = "plangbf",
|
flags = "plangbtf",
|
||||||
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" +
|
||||||
@ -356,6 +356,7 @@ public class UtilityCommands {
|
|||||||
" -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" +
|
" -b also kills ambient mobs.\n" +
|
||||||
|
" -t also kills mobs with name tags.\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,
|
||||||
@ -391,6 +392,7 @@ public class UtilityCommands {
|
|||||||
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.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");
|
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
|
// If you add flags here, please add them to com.sk89q.worldedit.commands.BrushCommands.butcherBrush() as well
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren