From 53d62c69662e9930f314c0c2f05fa983ce529b6f Mon Sep 17 00:00:00 2001 From: Iaccidentally Date: Sat, 9 Nov 2013 22:31:39 -0500 Subject: Add more functionality to the remove command. This now overlaps some functionality of the killall command, which should eventually be merged into this command and removed. new options: hostile, monsters, passive, animals, ambient, mobs, entities --- .../essentials/commands/Commandremove.java | 57 +++++++++++++++++++++- Essentials/src/plugin.yml | 2 +- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java index b1e5ccc50..7d4ad8351 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java @@ -10,6 +10,7 @@ import org.bukkit.World; import org.bukkit.entity.*; //Todo: Fix this up +//Todo: now overlaps some functions of killall, which should be deprecated and removed once all functions are covered public class Commandremove extends EssentialsCommand { public Commandremove() @@ -60,7 +61,6 @@ public class Commandremove extends EssentialsCommand throw new NotEnoughArgumentsException(ee); //TODO: translate and list types } } - removeEntities(user.getSource(), world, toRemove, radius); } @@ -110,6 +110,7 @@ public class Commandremove extends EssentialsCommand continue; } } + //TODO: this would probably be better as a case statement instead of all the ifs if (toRemove == ToRemove.DROPS) { if (e instanceof Item) @@ -174,6 +175,51 @@ public class Commandremove extends EssentialsCommand removed++; } } + else if (toRemove == ToRemove.AMBIENT) + { + if (e instanceof Flying) + { + e.remove(); + removed++; + } + } + else if (toRemove == ToRemove.HOSTILE || toRemove == ToRemove.MONSTERS) + { + if (e instanceof Monster || e instanceof ComplexLivingEntity || e instanceof Flying || e instanceof Slime) + { + e.remove(); + removed++; + } + } + else if (toRemove == ToRemove.PASSIVE || toRemove == ToRemove.ANIMALS) + { + if (e instanceof Animals || e instanceof NPC || e instanceof Snowman || e instanceof WaterMob) + { + e.remove(); + removed++; + } + } + else if (toRemove == ToRemove.MOBS) + { + if (e instanceof Animals || e instanceof NPC || e instanceof Snowman || e instanceof WaterMob + || e instanceof Monster || e instanceof ComplexLivingEntity || e instanceof Flying || e instanceof Slime) + { + e.remove(); + removed++; + } + } + else if (toRemove == ToRemove.ENTITIES) + { + if (e instanceof Entity) + { + if (e instanceof HumanEntity) + { + continue; + } + e.remove(); + removed++; + } + } } } sender.sendMessage(_("removed", removed)); @@ -189,6 +235,13 @@ public class Commandremove extends EssentialsCommand XP, PAINTINGS, ITEMFRAMES, - ENDERCRYSTALS + ENDERCRYSTALS, + HOSTILE, + MONSTERS, + PASSIVE, + ANIMALS, + AMBIENT, + MOBS, + ENTITIES } } diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index e647542ba..b2a8a0007 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -304,7 +304,7 @@ commands: aliases: [formula,eformula,method,emethod,erecipe,recipes,erecipes] remove: description: Removes entities in your world. - usage: / [radius] [world] + usage: / [radius] [world] aliases: [eremove] repair: description: Repairs the durability of one or all items. -- cgit v1.2.3