summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2014-05-18 14:17:55 +0100
committerKHobbits <rob@khobbits.co.uk>2014-05-18 14:43:07 +0100
commit5a7dceedf2839289bd6c7075bfcec6016017bd0b (patch)
treebac1057f709de063e5fa547c05a254717f108cd8 /Essentials/src/com/earth2me/essentials/commands
parentb3a24525d556285f201a8ff00c5cfce009355d1e (diff)
downloadEssentials-5a7dceedf2839289bd6c7075bfcec6016017bd0b.tar
Essentials-5a7dceedf2839289bd6c7075bfcec6016017bd0b.tar.gz
Essentials-5a7dceedf2839289bd6c7075bfcec6016017bd0b.tar.lz
Essentials-5a7dceedf2839289bd6c7075bfcec6016017bd0b.tar.xz
Essentials-5a7dceedf2839289bd6c7075bfcec6016017bd0b.zip
Exempt named mobs by default from /remove
Named mobs can be removed using /remove named Killing all mobs now requires /remove all,tamed,named
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandremove.java34
1 files changed, 25 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java
index a77b0b863..ef9d3c6af 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java
@@ -158,21 +158,36 @@ public class Commandremove extends EssentialsCommand
for (ToRemove toRemove : removeTypes)
{
- if (e instanceof Tameable && ((Tameable)e).isTamed())
+ // We should skip any TAMED animals unless we are specifially targetting them.
+ if (e instanceof Tameable && ((Tameable)e).isTamed()
+ && !removeTypes.contains(ToRemove.TAMED))
{
- if (toRemove == ToRemove.TAMED)
+ continue;
+ }
+
+ // We should skip any NAMED animals unless we are specifially targetting them.
+ if (e instanceof LivingEntity && ((LivingEntity)e).getCustomName() != null
+ && !removeTypes.contains(ToRemove.NAMED))
+ {
+ continue;
+ }
+
+ switch (toRemove)
+ {
+ case TAMED:
+ if (e instanceof Tameable && ((Tameable)e).isTamed())
{
e.remove();
removed++;
}
- else
+ break;
+ case NAMED:
+ if (e instanceof LivingEntity && ((LivingEntity)e).getCustomName() != null)
{
- continue;
+ e.remove();
+ removed++;
}
- }
-
- switch (toRemove)
- {
+ break;
case DROPS:
if (e instanceof Item)
{
@@ -305,6 +320,7 @@ public class Commandremove extends EssentialsCommand
ENTITIES,
ALL,
CUSTOM,
- TAMED
+ TAMED,
+ NAMED
}
} \ No newline at end of file