public static CraftPlayer getCraftPlayer(EntityPlayerMP player) { if (playerCache.containsKey(player.username.toLowerCase())) { CraftPlayer ply = playerCache.get(player.username.toLowerCase()); if (ply.getHandle().isDead) { ply.setHandle(player); return ply; } else { return ply; } } CraftPlayer ply = new CraftPlayer(player); playerCache.put(player.username.toLowerCase(), ply); return ply; }
public static void sendPacket(Player player, Packet packet) { ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); }