public static boolean resetPlayerConnection(Player player) {
CraftPlayer cp = (CraftPlayer) player;
CraftServer server = (CraftServer) Bukkit.getServer();
if (cp.getHandle().playerConnection instanceof SpoutPlayerConnection) {
PlayerConnection oldHandler = cp.getHandle().playerConnection;
/*Set<ChunkCoordIntPair> chunkUpdateQueue = ((SpoutPlayerConnection) cp.getHandle().playerConnection).getChunkUpdateQueue();
for (ChunkCoordIntPair c : chunkUpdateQueue) {
cp.getHandle().chunkCoordIntPairQueue.add(c);
}
((SpoutPlayerConnection) cp.getHandle().playerConnection).flushUnloadQueue();*/
cp.getHandle().playerConnection.a();
Location loc = player.getLocation();
PlayerConnection handler = new PlayerConnection(MinecraftServer.getServer(), cp.getHandle().playerConnection.networkManager, cp.getHandle());
handler.a(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
cp.getHandle().playerConnection = handler;
INetworkManager nm = cp.getHandle().playerConnection.networkManager;
setPlayerConnection(nm, cp.getHandle().playerConnection);
oldHandler.disconnected = true;
return true;