From df2c0e2308e82826067dd11d01b16a39bc18b694 Mon Sep 17 00:00:00 2001 From: Tanel Suurhans Date: Thu, 24 Feb 2011 21:37:53 +0200 Subject: [PATCH] implement World.getPlayers --- .../java/org/bukkit/craftbukkit/CraftWorld.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 9058a580aa..6b68b9cc3e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -448,4 +448,21 @@ public class CraftWorld implements World { return list; } + + public List getPlayers() { + List list = new ArrayList(); + + for (Object o : world.b) { + if (o instanceof net.minecraft.server.Entity) { + net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o; + Entity bukkitEntity = mcEnt.getBukkitEntity(); + + if ((bukkitEntity != null) && (bukkitEntity instanceof Player)) { + list.add((Player)bukkitEntity); + } + } + } + + return list; + } }