Force despawn of players on quit

This commit is contained in:
Shoghi Cervantes 2014-08-13 20:43:46 +02:00
parent 1f902d814e
commit 9c95441402
2 changed files with 2 additions and 2 deletions

View File

@ -2099,10 +2099,10 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
*/
public function close($message = "", $reason = "generic reason"){
if($this->connected === true){
parent::close();
if($this->username != ""){
$this->server->getPluginManager()->callEvent($ev = new PlayerQuitEvent($this, $message));
if($this->loggedIn === true){
parent::close();
$this->save();
}
}

View File

@ -1042,6 +1042,7 @@ abstract class Entity extends Position implements Metadatable{
public function close(){
if($this->closed === false){
$this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this));
$this->closed = true;
unset(Entity::$needUpdate[$this->id]);
if($this->chunk instanceof FullChunk){
@ -1049,7 +1050,6 @@ abstract class Entity extends Position implements Metadatable{
}
$this->getLevel()->removeEntity($this);
$this->despawnFromAll();
$this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this));
}
}