mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-27 05:00:08 +08:00
Added ALL and ITEM_FRAME to /remove'able entities
This commit is contained in:
parent
f9791d25ce
commit
2aab0369b5
@ -23,10 +23,13 @@
|
|||||||
* List of removable entity types.
|
* List of removable entity types.
|
||||||
*/
|
*/
|
||||||
public enum EntityType {
|
public enum EntityType {
|
||||||
ARROWS,
|
ALL,
|
||||||
|
@Deprecated ARROWS,
|
||||||
|
PROJECTILES,
|
||||||
ITEMS,
|
ITEMS,
|
||||||
FALLING_BLOCKS,
|
FALLING_BLOCKS,
|
||||||
PAINTINGS,
|
PAINTINGS,
|
||||||
|
ITEM_FRAMES,
|
||||||
BOATS,
|
BOATS,
|
||||||
MINECARTS,
|
MINECARTS,
|
||||||
TNT,
|
TNT,
|
||||||
|
@ -44,16 +44,18 @@
|
|||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
import org.bukkit.entity.Arrow;
|
|
||||||
import org.bukkit.entity.Boat;
|
import org.bukkit.entity.Boat;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.ExperienceOrb;
|
import org.bukkit.entity.ExperienceOrb;
|
||||||
import org.bukkit.entity.FallingBlock;
|
import org.bukkit.entity.FallingBlock;
|
||||||
|
import org.bukkit.entity.Hanging;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Minecart;
|
import org.bukkit.entity.Minecart;
|
||||||
import org.bukkit.entity.Painting;
|
import org.bukkit.entity.Painting;
|
||||||
|
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.inventory.DoubleChestInventory;
|
import org.bukkit.inventory.DoubleChestInventory;
|
||||||
@ -679,8 +681,16 @@ public int removeEntities(EntityType type, Vector origin, int radius) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == EntityType.ARROWS) {
|
if (type == EntityType.ALL) {
|
||||||
if (ent instanceof Arrow) {
|
if (ent instanceof Projectile || ent instanceof Boat || ent instanceof Item
|
||||||
|
|| ent instanceof FallingBlock || ent instanceof Minecart || ent instanceof Hanging
|
||||||
|
|| ent instanceof TNTPrimed || ent instanceof ExperienceOrb) {
|
||||||
|
ent.remove();
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
} else if (type == EntityType.PROJECTILES || type == EntityType.ARROWS) {
|
||||||
|
if (ent instanceof Projectile) {
|
||||||
|
// covers: arrow, egg, enderpearl, fireball, fish, snowball, throwpotion, thrownexpbottle
|
||||||
ent.remove();
|
ent.remove();
|
||||||
++num;
|
++num;
|
||||||
}
|
}
|
||||||
@ -709,6 +719,11 @@ public int removeEntities(EntityType type, Vector origin, int radius) {
|
|||||||
ent.remove();
|
ent.remove();
|
||||||
++num;
|
++num;
|
||||||
}
|
}
|
||||||
|
} else if (type == EntityType.ITEM_FRAMES) {
|
||||||
|
if (ent instanceof ItemFrame) {
|
||||||
|
ent.remove();
|
||||||
|
++num;
|
||||||
|
}
|
||||||
} else if (type == EntityType.TNT) {
|
} else if (type == EntityType.TNT) {
|
||||||
if (ent instanceof TNTPrimed) {
|
if (ent instanceof TNTPrimed) {
|
||||||
ent.remove();
|
ent.remove();
|
||||||
|
@ -460,8 +460,10 @@ public void remove(CommandContext args, LocalSession session, LocalPlayer player
|
|||||||
|
|
||||||
EntityType type = null;
|
EntityType type = null;
|
||||||
|
|
||||||
if (typeStr.matches("arrows?")) {
|
if (typeStr.matches("all")) {
|
||||||
type = EntityType.ARROWS;
|
type = EntityType.ALL;
|
||||||
|
} else if (typeStr.matches("projectiles?|arrows?")) {
|
||||||
|
type = EntityType.PROJECTILES;
|
||||||
} else if (typeStr.matches("items?")
|
} else if (typeStr.matches("items?")
|
||||||
|| typeStr.matches("drops?")) {
|
|| typeStr.matches("drops?")) {
|
||||||
type = EntityType.ITEMS;
|
type = EntityType.ITEMS;
|
||||||
@ -470,6 +472,8 @@ public void remove(CommandContext args, LocalSession session, LocalPlayer player
|
|||||||
} else if (typeStr.matches("paintings?")
|
} else if (typeStr.matches("paintings?")
|
||||||
|| typeStr.matches("art")) {
|
|| typeStr.matches("art")) {
|
||||||
type = EntityType.PAINTINGS;
|
type = EntityType.PAINTINGS;
|
||||||
|
} else if (typeStr.matches("(item)frames?")) {
|
||||||
|
type = EntityType.ITEM_FRAMES;
|
||||||
} else if (typeStr.matches("boats?")) {
|
} else if (typeStr.matches("boats?")) {
|
||||||
type = EntityType.BOATS;
|
type = EntityType.BOATS;
|
||||||
} else if (typeStr.matches("minecarts?")
|
} else if (typeStr.matches("minecarts?")
|
||||||
@ -480,7 +484,7 @@ public void remove(CommandContext args, LocalSession session, LocalPlayer player
|
|||||||
} else if (typeStr.matches("xp")) {
|
} else if (typeStr.matches("xp")) {
|
||||||
type = EntityType.XP_ORBS;
|
type = EntityType.XP_ORBS;
|
||||||
} else {
|
} else {
|
||||||
player.printError("Acceptable types: arrows, items, paintings, boats, minecarts, tnt, xp");
|
player.printError("Acceptable types: projectiles, items, paintings, itemframes, boats, minecarts, tnt, xp, or all");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user