summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorturt2live <travpc@gmail.com>2014-02-01 20:46:23 -0700
committerWesley Wolfe <weswolf@aol.com>2014-02-01 22:52:01 -0600
commitc59ba98ae6c61c78827a33a3138ade5462d9ae11 (patch)
tree75d89ab3c9fbf0f25adb53c639abf7c98775dd8d /src
parentd7d81fa68fb439c41547d347dd099261ff28af17 (diff)
downloadcraftbukkit-c59ba98ae6c61c78827a33a3138ade5462d9ae11.tar
craftbukkit-c59ba98ae6c61c78827a33a3138ade5462d9ae11.tar.gz
craftbukkit-c59ba98ae6c61c78827a33a3138ade5462d9ae11.tar.lz
craftbukkit-c59ba98ae6c61c78827a33a3138ade5462d9ae11.tar.xz
craftbukkit-c59ba98ae6c61c78827a33a3138ade5462d9ae11.zip
[Bleeding] Handle players disconnecting during respawn. Fixes BUKKIT-4327
Prior to this commit, a player disconnected during a respawn event would remain in memory. This causes a ghosting issue of players in the slot count and player list, as well as a reference leak. This commit avoids re-adding the player to the player list (and world) if they are disconnected. This ensures that the remainder of the respawn logic is completed as well as ensuring a duplicate player is not left on the server. This commit also saves the player's file at the end of the method if they have been disconnected to ensure that their next login is accurate to the respawn event's actions. A player that was revived and disconnected will reconnect as revived.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/PlayerList.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 534073b3..43832753 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -498,10 +498,14 @@ public abstract class PlayerList {
entityplayer1.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(chunkcoordinates1.x, chunkcoordinates1.y, chunkcoordinates1.z));
entityplayer1.playerConnection.sendPacket(new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel));
this.b(entityplayer1, worldserver);
- worldserver.getPlayerChunkMap().addPlayer(entityplayer1);
- worldserver.addEntity(entityplayer1);
- this.players.add(entityplayer1);
- // CraftBukkit start - Added from changeDimension
+ // CraftBukkit start
+ // Don't re-add player to player list if disconnected
+ if (!entityplayer.playerConnection.isDisconnected()) {
+ worldserver.getPlayerChunkMap().addPlayer(entityplayer1);
+ worldserver.addEntity(entityplayer1);
+ this.players.add(entityplayer1);
+ }
+ // Added from changeDimension
this.updateClient(entityplayer1); // Update health, etc...
entityplayer1.updateAbilities();
Iterator iterator = entityplayer1.getEffects().iterator();
@@ -515,11 +519,17 @@ public abstract class PlayerList {
// CraftBukkit end
entityplayer1.setHealth(entityplayer1.getHealth());
- // CraftBukkit start - Don't fire on respawn
+ // CraftBukkit start
+ // Don't fire on respawn
if (fromWorld != location.getWorld()) {
PlayerChangedWorldEvent event = new PlayerChangedWorldEvent((Player) entityplayer1.getBukkitEntity(), fromWorld);
Bukkit.getServer().getPluginManager().callEvent(event);
}
+
+ // Save player file again if they were disconnected
+ if (entityplayer.playerConnection.isDisconnected()) {
+ this.b(entityplayer1);
+ }
// CraftBukkit end
return entityplayer1;