summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorTanel Suurhans <tanel.suurhans@perfectline.ee>2011-02-24 21:37:53 +0200
committerDinnerbone <dinnerbone@dinnerbone.com>2011-02-28 16:20:44 +0000
commitdf2c0e2308e82826067dd11d01b16a39bc18b694 (patch)
tree86abaa9f3271f9876f7834f6a5e425160618f3e9 /src/main/java
parentd1e3d01036680ad8590db8a54a3d39ef2e0bd3dd (diff)
downloadcraftbukkit-df2c0e2308e82826067dd11d01b16a39bc18b694.tar
craftbukkit-df2c0e2308e82826067dd11d01b16a39bc18b694.tar.gz
craftbukkit-df2c0e2308e82826067dd11d01b16a39bc18b694.tar.lz
craftbukkit-df2c0e2308e82826067dd11d01b16a39bc18b694.tar.xz
craftbukkit-df2c0e2308e82826067dd11d01b16a39bc18b694.zip
implement World.getPlayers
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 9058a580..6b68b9cc 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<Player> getPlayers() {
+ List<Player> list = new ArrayList<Player>();
+
+ 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;
+ }
}