From 9c1352075b542d480fa211a8f80e3a3f4fbebf40 Mon Sep 17 00:00:00 2001
From: Alex Ciuba <alexciuba@gmail.com>
Date: Tue, 11 Jun 2013 15:23:03 -0400
Subject: [PATCH] Prevent Ghost Players Caused by Plugins

Check if the player is still connected after firing event. Fixes BUKKIT-4327

diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index b21a5b7..f878dfc 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -605,6 +605,11 @@ public abstract class PlayerList {
             Player respawnPlayer = cserver.getPlayer(entityplayer1);
             PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
             cserver.getPluginManager().callEvent(respawnEvent);
+            // Spigot Start
+            if (entityplayer.playerConnection.isDisconnected()) {
+                return entityplayer;
+            }
+            // Spigot End
 
             location = respawnEvent.getRespawnLocation();
             entityplayer.reset();
-- 
2.5.0