mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 21:17:00 +01:00
implement World.getPlayers
This commit is contained in:
parent
d1e3d01036
commit
df2c0e2308
1 changed files with 17 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue