mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-25 17:51:31 +01:00
Clean up World.getPlayers().
Original idea from CyberTiger, PR #150 By: md_5 <git@md-5.net>
This commit is contained in:
parent
edf24d4fd6
commit
2d453c57bf
@ -721,16 +721,13 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public List<Player> getPlayers() {
|
||||
List<Player> list = new ArrayList<Player>();
|
||||
List<Player> list = new ArrayList<Player>(world.players.size());
|
||||
|
||||
for (Object o : world.entityList) {
|
||||
if (o instanceof net.minecraft.server.Entity) {
|
||||
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o;
|
||||
Entity bukkitEntity = mcEnt.getBukkitEntity();
|
||||
for (EntityHuman human : world.players) {
|
||||
HumanEntity bukkitEntity = human.getBukkitEntity();
|
||||
|
||||
if ((bukkitEntity != null) && (bukkitEntity instanceof Player)) {
|
||||
list.add((Player) bukkitEntity);
|
||||
}
|
||||
if ((bukkitEntity != null) && (bukkitEntity instanceof Player)) {
|
||||
list.add((Player) bukkitEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user