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
commitf400f81e4d95a90d5ec4034322365404c5818a35 (patch)
tree9450f5615ccce4c1f4149b3ec315a28aed704be9
parent5d1ea4aa88c2cc5f50e47e95be8626c3a9eff0c9 (diff)
downloadEssentials-f400f81e4d95a90d5ec4034322365404c5818a35.tar
Essentials-f400f81e4d95a90d5ec4034322365404c5818a35.tar.gz
Essentials-f400f81e4d95a90d5ec4034322365404c5818a35.tar.lz
Essentials-f400f81e4d95a90d5ec4034322365404c5818a35.tar.xz
Essentials-f400f81e4d95a90d5ec4034322365404c5818a35.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.