From 9e04f2f765194c087b52c3707a482ed9d5e56c8d Mon Sep 17 00:00:00 2001 From: zreed Date: Fri, 5 Dec 2014 01:44:14 -0500 Subject: [PATCH] Use PlayerList's UUID->EntityPlayer map in CraftServer.getPlayer(UUID) --- src/main/java/org/bukkit/craftbukkit/CraftServer.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 64b2961b05..075a7fd4d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/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;