TFM-4.3-Reloaded/src/me/StevenLawson/TotalFreedomMod/Commands/Command_mp.java

42 lines
1.2 KiB
Java
Raw Normal View History

2011-10-19 00:37:00 +00:00
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*;
public class Command_mp extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || sender.isOp())
{
sender.sendMessage(ChatColor.GRAY + "Purging all mobs...");
int removed = 0;
for (World world : server.getWorlds())
2011-10-19 00:37:00 +00:00
{
2011-11-21 05:54:11 +00:00
for (Entity ent : world.getLivingEntities())
2011-10-19 00:37:00 +00:00
{
2011-11-21 05:54:11 +00:00
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon)
2011-10-19 00:37:00 +00:00
{
ent.remove();
removed++;
}
}
}
sender.sendMessage(ChatColor.GRAY + String.valueOf(removed) + " mobs removed.");
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}
}