Call PlayerQuitEvent in correct location. Fixes BUKKIT-2193

This commit is contained in:
Travis Watkins 2012-08-15 12:22:52 -05:00
parent fc35d000e4
commit add387dee3

View File

@ -201,18 +201,19 @@ public abstract class ServerConfigurationManagerAbstract {
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string
if (entityplayer.netServerHandler.disconnected) return null; // CraftBukkit - exploitsies fix
// this.b(entityplayer); // CraftBukkit - Quitting must be before we do final save of data, in case plugins need to modify it
// CraftBukkit start - quitting must be before we do final save of data, in case plugins need to modify it
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
this.cserver.getPluginManager().callEvent(playerQuitEvent);
// CraftBukkit end
this.b(entityplayer);
WorldServer worldserver = entityplayer.q();
worldserver.kill(entityplayer);
worldserver.getPlayerManager().removePlayer(entityplayer);
this.players.remove(entityplayer);
// CraftBukkit start
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
this.cserver.getPluginManager().callEvent(playerQuitEvent);
// .name -> .listName, replace sendAll with loop
// CraftBukkit start - .name -> .listName, replace sendAll with loop
Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, false, 9999);
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
@ -222,8 +223,6 @@ public abstract class ServerConfigurationManagerAbstract {
}
}
this.b(entityplayer);
return playerQuitEvent.getQuitMessage();
// CraftBukkit end
}