Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-20 01: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:
Ursprung
dc6ffae500
Commit
ec9c77c31b
@ -38,13 +38,14 @@ 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.entity.Villager;
|
||||||
|
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
class BukkitEntityType implements EntityType {
|
class BukkitEntityType implements EntityType {
|
||||||
|
|
||||||
private static final org.bukkit.entity.EntityType tntMinecartType =
|
private static final org.bukkit.entity.EntityType armorStandType =
|
||||||
Enums.findByValue(org.bukkit.entity.EntityType.class, "MINECART_TNT");
|
Enums.findByValue(org.bukkit.entity.EntityType.class, "ARMOR_STAND");
|
||||||
|
|
||||||
private final Entity entity;
|
private final Entity entity;
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ class BukkitEntityType implements EntityType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTNT() {
|
public boolean isTNT() {
|
||||||
return entity instanceof TNTPrimed || entity.getType() == tntMinecartType;
|
return entity instanceof TNTPrimed || entity instanceof ExplosiveMinecart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -137,4 +138,9 @@ class BukkitEntityType implements EntityType {
|
|||||||
public boolean isTagged() {
|
public boolean isTagged() {
|
||||||
return entity instanceof LivingEntity && ((LivingEntity) entity).getCustomName() != null;
|
return entity instanceof LivingEntity && ((LivingEntity) entity).getCustomName() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isArmorStand() {
|
||||||
|
return entity.getType() == armorStandType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,12 +22,7 @@ package com.sk89q.worldedit.command;
|
|||||||
import com.sk89q.minecraft.util.commands.Command;
|
import com.sk89q.minecraft.util.commands.Command;
|
||||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.*;
|
||||||
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.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.BlockID;
|
import com.sk89q.worldedit.blocks.BlockID;
|
||||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||||
@ -229,10 +224,10 @@ public class BrushCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
aliases = { "butcher", "kill" },
|
aliases = { "butcher", "kill" },
|
||||||
usage = "[radius]",
|
usage = "[radius]",
|
||||||
flags = "plangbtf",
|
flags = "plangbtfr",
|
||||||
desc = "Butcher brush",
|
desc = "Butcher brush",
|
||||||
help = "Kills nearby mobs within the specified radius.\n" +
|
help = "Kills nearby mobs within the specified radius.\n" +
|
||||||
"Flags:" +
|
"Flags:\n" +
|
||||||
" -p also kills pets.\n" +
|
" -p also kills pets.\n" +
|
||||||
" -n also kills NPCs.\n" +
|
" -n also kills NPCs.\n" +
|
||||||
" -g also kills Golems.\n" +
|
" -g also kills Golems.\n" +
|
||||||
@ -240,6 +235,7 @@ public class BrushCommands {
|
|||||||
" -b also kills ambient mobs.\n" +
|
" -b also kills ambient mobs.\n" +
|
||||||
" -t also kills mobs with name tags.\n" +
|
" -t also kills mobs with name tags.\n" +
|
||||||
" -f compounds all previous flags.\n" +
|
" -f compounds all previous flags.\n" +
|
||||||
|
" -r also destroys armor stands.\n" +
|
||||||
" -l currently does nothing.",
|
" -l currently does nothing.",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 1
|
max = 1
|
||||||
|
@ -366,11 +366,11 @@ public class UtilityCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
aliases = { "butcher" },
|
aliases = { "butcher" },
|
||||||
usage = "[radius]",
|
usage = "[radius]",
|
||||||
flags = "plangbtf",
|
flags = "plangbtfr",
|
||||||
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" +
|
||||||
"Flags:" +
|
"Flags:\n" +
|
||||||
" -p also kills pets.\n" +
|
" -p also kills pets.\n" +
|
||||||
" -n also kills NPCs.\n" +
|
" -n also kills NPCs.\n" +
|
||||||
" -g also kills Golems.\n" +
|
" -g also kills Golems.\n" +
|
||||||
@ -378,6 +378,7 @@ public class UtilityCommands {
|
|||||||
" -b also kills ambient mobs.\n" +
|
" -b also kills ambient mobs.\n" +
|
||||||
" -t also kills mobs with name tags.\n" +
|
" -t also kills mobs with name tags.\n" +
|
||||||
" -f compounds all previous flags.\n" +
|
" -f compounds all previous flags.\n" +
|
||||||
|
" -r also destroys armor stands.\n" +
|
||||||
" -l currently does nothing.",
|
" -l currently does nothing.",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 1
|
max = 1
|
||||||
|
@ -41,6 +41,7 @@ public class CreatureButcher {
|
|||||||
public static final int AMBIENT = 1 << 4;
|
public static final int AMBIENT = 1 << 4;
|
||||||
public static final int TAGGED = 1 << 5;
|
public static final int TAGGED = 1 << 5;
|
||||||
public static final int FRIENDLY = PETS | NPCS | ANIMALS | GOLEMS | AMBIENT | TAGGED;
|
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;
|
public static final int WITH_LIGHTNING = 1 << 20;
|
||||||
|
|
||||||
private Flags() {
|
private Flags() {
|
||||||
@ -74,6 +75,8 @@ public class CreatureButcher {
|
|||||||
or(Flags.ANIMALS , args.hasFlag('a'), "worldedit.butcher.animals");
|
or(Flags.ANIMALS , args.hasFlag('a'), "worldedit.butcher.animals");
|
||||||
or(Flags.AMBIENT , args.hasFlag('b'), "worldedit.butcher.ambient");
|
or(Flags.AMBIENT , args.hasFlag('b'), "worldedit.butcher.ambient");
|
||||||
or(Flags.TAGGED , args.hasFlag('t'), "worldedit.butcher.tagged");
|
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");
|
or(Flags.WITH_LIGHTNING, args.hasFlag('l'), "worldedit.butcher.lightning");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +90,7 @@ public class CreatureButcher {
|
|||||||
boolean killGolems = (flags & Flags.GOLEMS) != 0;
|
boolean killGolems = (flags & Flags.GOLEMS) != 0;
|
||||||
boolean killAmbient = (flags & Flags.AMBIENT) != 0;
|
boolean killAmbient = (flags & Flags.AMBIENT) != 0;
|
||||||
boolean killTagged = (flags & Flags.TAGGED) != 0;
|
boolean killTagged = (flags & Flags.TAGGED) != 0;
|
||||||
|
boolean killArmorStands = (flags & Flags.ARMOR_STAND) != 0;
|
||||||
|
|
||||||
EntityType type = entity.getFacet(EntityType.class);
|
EntityType type = entity.getFacet(EntityType.class);
|
||||||
|
|
||||||
@ -126,6 +130,10 @@ public class CreatureButcher {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!killArmorStands && type.isArmorStand()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
entity.remove();
|
entity.remove();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -148,4 +148,10 @@ public interface EntityType {
|
|||||||
*/
|
*/
|
||||||
boolean isTagged();
|
boolean isTagged();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether the entity is an armor stand.
|
||||||
|
*
|
||||||
|
* @return true if an armor stand
|
||||||
|
*/
|
||||||
|
boolean isArmorStand();
|
||||||
}
|
}
|
||||||
|
@ -135,4 +135,9 @@ public class ForgeEntityType implements EntityType {
|
|||||||
public boolean isTagged() {
|
public boolean isTagged() {
|
||||||
return entity instanceof EntityLiving && ((EntityLiving) entity).hasCustomNameTag();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren