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

Excluded armor stands from //butcher by default.

Someone got lazy and just made armor stands a living entity instead of extracting an ArmorEquippable interface.
Dieser Commit ist enthalten in:
wizjany 2015-01-22 15:48:45 -05:00
Ursprung dc6ffae500
Commit ec9c77c31b
6 geänderte Dateien mit 35 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -38,13 +38,14 @@ import org.bukkit.entity.Projectile;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.Villager;
import org.bukkit.entity.minecart.ExplosiveMinecart;
import static com.google.common.base.Preconditions.checkNotNull;
class BukkitEntityType implements EntityType {
private static final org.bukkit.entity.EntityType tntMinecartType =
Enums.findByValue(org.bukkit.entity.EntityType.class, "MINECART_TNT");
private static final org.bukkit.entity.EntityType armorStandType =
Enums.findByValue(org.bukkit.entity.EntityType.class, "ARMOR_STAND");
private final Entity entity;
@ -95,7 +96,7 @@ class BukkitEntityType implements EntityType {
@Override
public boolean isTNT() {
return entity instanceof TNTPrimed || entity.getType() == tntMinecartType;
return entity instanceof TNTPrimed || entity instanceof ExplosiveMinecart;
}
@Override
@ -137,4 +138,9 @@ class BukkitEntityType implements EntityType {
public boolean isTagged() {
return entity instanceof LivingEntity && ((LivingEntity) entity).getCustomName() != null;
}
@Override
public boolean isArmorStand() {
return entity.getType() == armorStandType;
}
}

Datei anzeigen

@ -22,12 +22,7 @@ package com.sk89q.worldedit.command;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.command.tool.BrushTool;
@ -229,10 +224,10 @@ public class BrushCommands {
@Command(
aliases = { "butcher", "kill" },
usage = "[radius]",
flags = "plangbtf",
flags = "plangbtfr",
desc = "Butcher brush",
help = "Kills nearby mobs within the specified radius.\n" +
"Flags:" +
"Flags:\n" +
" -p also kills pets.\n" +
" -n also kills NPCs.\n" +
" -g also kills Golems.\n" +
@ -240,6 +235,7 @@ public class BrushCommands {
" -b also kills ambient mobs.\n" +
" -t also kills mobs with name tags.\n" +
" -f compounds all previous flags.\n" +
" -r also destroys armor stands.\n" +
" -l currently does nothing.",
min = 0,
max = 1

Datei anzeigen

@ -366,11 +366,11 @@ public class UtilityCommands {
@Command(
aliases = { "butcher" },
usage = "[radius]",
flags = "plangbtf",
flags = "plangbtfr",
desc = "Kill all or nearby mobs",
help =
"Kills nearby mobs, based on radius, if none is given uses default in configuration.\n" +
"Flags:" +
"Flags:\n" +
" -p also kills pets.\n" +
" -n also kills NPCs.\n" +
" -g also kills Golems.\n" +
@ -378,6 +378,7 @@ public class UtilityCommands {
" -b also kills ambient mobs.\n" +
" -t also kills mobs with name tags.\n" +
" -f compounds all previous flags.\n" +
" -r also destroys armor stands.\n" +
" -l currently does nothing.",
min = 0,
max = 1

Datei anzeigen

@ -41,6 +41,7 @@ public class CreatureButcher {
public static final int AMBIENT = 1 << 4;
public static final int TAGGED = 1 << 5;
public static final int FRIENDLY = PETS | NPCS | ANIMALS | GOLEMS | AMBIENT | TAGGED;
public static final int ARMOR_STAND = 1 << 6;
public static final int WITH_LIGHTNING = 1 << 20;
private Flags() {
@ -74,6 +75,8 @@ public class CreatureButcher {
or(Flags.ANIMALS , args.hasFlag('a'), "worldedit.butcher.animals");
or(Flags.AMBIENT , args.hasFlag('b'), "worldedit.butcher.ambient");
or(Flags.TAGGED , args.hasFlag('t'), "worldedit.butcher.tagged");
or(Flags.ARMOR_STAND , args.hasFlag('r'), "worldedit.butcher.armorstands");
or(Flags.WITH_LIGHTNING, args.hasFlag('l'), "worldedit.butcher.lightning");
}
@ -87,6 +90,7 @@ public class CreatureButcher {
boolean killGolems = (flags & Flags.GOLEMS) != 0;
boolean killAmbient = (flags & Flags.AMBIENT) != 0;
boolean killTagged = (flags & Flags.TAGGED) != 0;
boolean killArmorStands = (flags & Flags.ARMOR_STAND) != 0;
EntityType type = entity.getFacet(EntityType.class);
@ -126,6 +130,10 @@ public class CreatureButcher {
return false;
}
if (!killArmorStands && type.isArmorStand()) {
return false;
}
entity.remove();
return true;
}

Datei anzeigen

@ -148,4 +148,10 @@ public interface EntityType {
*/
boolean isTagged();
/**
* Test whether the entity is an armor stand.
*
* @return true if an armor stand
*/
boolean isArmorStand();
}

Datei anzeigen

@ -135,4 +135,9 @@ public class ForgeEntityType implements EntityType {
public boolean isTagged() {
return entity instanceof EntityLiving && ((EntityLiving) entity).hasCustomNameTag();
}
@Override
public boolean isArmorStand() {
return false; // TODO re-add when forge version is updated to 1.8: entity instanceof EntityArmorStand;
}
}