summaryrefslogtreecommitdiffstats
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
commit7e8ba9a256029e6238ef7ce2e909e2d02eecd49b (patch)
tree85763a99a646282abc847f6f7c8a5ae922a37782
parentb145ec59ea5b2b4046ac6d474f141ba974aebd53 (diff)
downloadEssentials-7e8ba9a256029e6238ef7ce2e909e2d02eecd49b.tar
Essentials-7e8ba9a256029e6238ef7ce2e909e2d02eecd49b.tar.gz
Essentials-7e8ba9a256029e6238ef7ce2e909e2d02eecd49b.tar.lz
Essentials-7e8ba9a256029e6238ef7ce2e909e2d02eecd49b.tar.xz
Essentials-7e8ba9a256029e6238ef7ce2e909e2d02eecd49b.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
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandremove.java34
-rw-r--r--Essentials/src/plugin.yml2
2 files changed, 26 insertions, 10 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
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index af056c15a..23d0bd17a 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> <all|tamed|drops|arrows|boats|minecarts|xp|paintings|itemframes|endercrystals|monsters|animals|ambient|mobs|[mobType]> [radius|world]
+ usage: /<command> <all|tamed|named|drops|arrows|boats|minecarts|xp|paintings|itemframes|endercrystals|monsters|animals|ambient|mobs|[mobType]> [radius|world]
aliases: [eremove,butcher,ebutcher,killall,ekillall,mobkill,emobkill]
repair:
description: Repairs the durability of one or all items.