diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index ead6a43028..7cca8b1ddb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1,6 +1,7 @@ package org.bukkit.craftbukkit.entity; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.MapMaker; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.InetSocketAddress; @@ -36,7 +37,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { private long lastPlayed = 0; private boolean hasPlayedBefore = false; private Set channels = new HashSet(); - private Set hiddenPlayers = new HashSet(); + private Map hiddenPlayers = new MapMaker().softValues().makeMap(); private int hash = 0; public CraftPlayer(CraftServer server, EntityPlayer entity) { @@ -564,8 +565,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void hidePlayer(Player player) { - if (hiddenPlayers.contains(player)) return; - hiddenPlayers.add(player); + if (hiddenPlayers.containsKey(player.getName())) return; + hiddenPlayers.put(player.getName(), player); //remove this player from the hidden player's EntityTrackerEntry EntityTracker tracker = ((WorldServer) entity.world).tracker; @@ -580,8 +581,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void showPlayer(Player player) { - if (!hiddenPlayers.contains(player)) return; - hiddenPlayers.remove(player); + if (!hiddenPlayers.containsKey(player.getName())) return; + hiddenPlayers.remove(player.getName()); EntityTracker tracker = ((WorldServer) entity.world).tracker; EntityPlayer other = ((CraftPlayer) player).getHandle(); @@ -594,7 +595,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public boolean canSee(Player player) { - return !hiddenPlayers.contains(player); + return !hiddenPlayers.containsKey(player.getName()); } public Map serialize() {