diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-09-28 21:48:29 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-09-28 21:48:29 +0100 |
commit | 7678dabfb2d3550d51cf1514807885e6e7b37b20 (patch) | |
tree | e01f7bb0b12df0e533fcdd859fb702ede5f31297 /src/main/java/com/yulqen/test/KillZombies.java | |
parent | be838b99c1b108049d0027b7ee79dd06f1a5f05a (diff) |
joe tires, sophie mines iron, two commands
Diffstat (limited to '')
-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; + } +} |