diff options
Diffstat (limited to 'src/main/java/com/yulqen/test/KillZombies.java')
-rw-r--r-- | src/main/java/com/yulqen/test/KillZombies.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/com/yulqen/test/KillZombies.java b/src/main/java/com/yulqen/test/KillZombies.java new file mode 100644 index 0000000..beea25e --- /dev/null +++ b/src/main/java/com/yulqen/test/KillZombies.java @@ -0,0 +1,30 @@ +package com.yulqen.test; + +import com.sun.source.tree.Tree; +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.Zombie; + +import java.util.Collection; + +import static org.bukkit.Bukkit.getServer; + +public class KillZombies implements CommandExecutor { + @Override + public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { + + World world = getServer().getWorld("mad_march_hare"); + Collection<Entity> zombies = world.getEntitiesByClasses(Zombie.class); + for (Entity z : zombies) { + z.remove(); + } + if (zombies.isEmpty()) { + return false; + } + System.out.println("Killed all the zombies..."); + return true; + } +} |