summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2013-11-09 22:31:39 -0500
committerKHobbits <rob@khobbits.co.uk>2013-11-10 23:25:34 +0000
commit53d62c69662e9930f314c0c2f05fa983ce529b6f (patch)
tree03633a10e8ad3cc0f933d22594f4e4e8ae0d8309
parenta9e62516bc63d5f7c0e73a8169f46d2a593da901 (diff)
downloadEssentials-53d62c69662e9930f314c0c2f05fa983ce529b6f.tar
Essentials-53d62c69662e9930f314c0c2f05fa983ce529b6f.tar.gz
Essentials-53d62c69662e9930f314c0c2f05fa983ce529b6f.tar.lz
Essentials-53d62c69662e9930f314c0c2f05fa983ce529b6f.tar.xz
Essentials-53d62c69662e9930f314c0c2f05fa983ce529b6f.zip
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
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandremove.java57
-rw-r--r--Essentials/src/plugin.yml2
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: /<command> <drops|arrows|boats|minecarts|xp|paintings|itemframes|endercrystals> [radius] [world]
+ usage: /<command> <drops|arrows|boats|minecarts|xp|paintings|itemframes|endercrystals|hostile|monsters|passive|animals|ambient|mobs|entities> [radius] [world]
aliases: [eremove]
repair:
description: Repairs the durability of one or all items.