Exempt named mobs by default from /remove

Named mobs can be removed using /remove named
Killing all mobs now requires /remove all,tamed,named
This commit is contained in:
KHobbits 2014-05-18 14:17:55 +01:00
parent b145ec59ea
commit 7e8ba9a256
2 changed files with 28 additions and 12 deletions

View File

@ -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)
{
e.remove();
removed++;
}
else
{
continue;
}
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++;
}
break;
case NAMED:
if (e instanceof LivingEntity && ((LivingEntity)e).getCustomName() != null)
{
e.remove();
removed++;
}
break;
case DROPS:
if (e instanceof Item)
{
@ -305,6 +320,7 @@ public class Commandremove extends EssentialsCommand
ENTITIES,
ALL,
CUSTOM,
TAMED
TAMED,
NAMED
}
}

View File

@ -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.