mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
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
This commit is contained in:
parent
5d1ea4aa88
commit
f400f81e4d
2 changed files with 56 additions and 3 deletions
|
@ -10,6 +10,7 @@ import org.bukkit.World;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
|
||||||
//Todo: Fix this up
|
//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 class Commandremove extends EssentialsCommand
|
||||||
{
|
{
|
||||||
public Commandremove()
|
public Commandremove()
|
||||||
|
@ -60,7 +61,6 @@ public class Commandremove extends EssentialsCommand
|
||||||
throw new NotEnoughArgumentsException(ee); //TODO: translate and list types
|
throw new NotEnoughArgumentsException(ee); //TODO: translate and list types
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeEntities(user.getSource(), world, toRemove, radius);
|
removeEntities(user.getSource(), world, toRemove, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,7 @@ public class Commandremove extends EssentialsCommand
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//TODO: this would probably be better as a case statement instead of all the ifs
|
||||||
if (toRemove == ToRemove.DROPS)
|
if (toRemove == ToRemove.DROPS)
|
||||||
{
|
{
|
||||||
if (e instanceof Item)
|
if (e instanceof Item)
|
||||||
|
@ -174,6 +175,51 @@ public class Commandremove extends EssentialsCommand
|
||||||
removed++;
|
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));
|
sender.sendMessage(_("removed", removed));
|
||||||
|
@ -189,6 +235,13 @@ public class Commandremove extends EssentialsCommand
|
||||||
XP,
|
XP,
|
||||||
PAINTINGS,
|
PAINTINGS,
|
||||||
ITEMFRAMES,
|
ITEMFRAMES,
|
||||||
ENDERCRYSTALS
|
ENDERCRYSTALS,
|
||||||
|
HOSTILE,
|
||||||
|
MONSTERS,
|
||||||
|
PASSIVE,
|
||||||
|
ANIMALS,
|
||||||
|
AMBIENT,
|
||||||
|
MOBS,
|
||||||
|
ENTITIES
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,7 @@ commands:
|
||||||
aliases: [formula,eformula,method,emethod,erecipe,recipes,erecipes]
|
aliases: [formula,eformula,method,emethod,erecipe,recipes,erecipes]
|
||||||
remove:
|
remove:
|
||||||
description: Removes entities in your world.
|
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]
|
aliases: [eremove]
|
||||||
repair:
|
repair:
|
||||||
description: Repairs the durability of one or all items.
|
description: Repairs the durability of one or all items.
|
||||||
|
|
Loading…
Reference in a new issue