2019-12-17 12:37:59 +00:00
|
|
|
package pw.kaboom.extras.commands;
|
2019-07-30 14:41:54 +00:00
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.World;
|
|
|
|
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
|
2019-12-17 12:37:59 +00:00
|
|
|
public class CommandDestroyEntities implements CommandExecutor {
|
2019-07-30 14:41:54 +00:00
|
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
|
|
int entityCount = 0;
|
|
|
|
int worldCount = 0;
|
|
|
|
|
|
|
|
for (World world : Bukkit.getWorlds()) {
|
|
|
|
for (Entity entity : world.getEntities()) {
|
|
|
|
if (entity.getType() != EntityType.PLAYER) {
|
|
|
|
entity.remove();
|
|
|
|
entityCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
worldCount++;
|
|
|
|
}
|
2019-09-22 02:37:43 +00:00
|
|
|
sender.sendMessage("Successfully destroyed " + entityCount + " entities in " + worldCount + " worlds");
|
2019-07-30 14:41:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|