From 475a7cb5793692771e726cbd9d76ad9fc25bc3eb Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Fri, 5 Dec 2014 01:44:14 -0500 Subject: [PATCH] Use PlayerList's UUID->EntityPlayer map in CraftServer.getPlayer(UUID) By: zreed --- .../main/java/org/bukkit/craftbukkit/CraftServer.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 64b2961b05..075a7fd4d3 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -415,13 +415,12 @@ public final class CraftServer implements Server { return null; } - // TODO: In 1.8+ this should use the server's UUID->EntityPlayer map @Override public Player getPlayer(UUID id) { - for (Player player : getOnlinePlayers()) { - if (player.getUniqueId().equals(id)) { - return player; - } + EntityPlayer player = playerList.a(id); + + if (player != null) { + return player.getBukkitEntity(); } return null;