Fixed #1591, handle player disconnect and level change killing

This commit is contained in:
Shoghi Cervantes
2014-07-10 12:35:19 +02:00
parent 589fde27c0
commit 4d0b184ca4
3 changed files with 16 additions and 9 deletions

View File

@@ -425,7 +425,10 @@ abstract class Entity extends Position implements Metadatable{
}
if($this->y < -64){
$this->kill();
$this->server->getPluginManager()->callEvent($ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_VOID, 10));
if(!$ev->isCancelled()){
$this->attack($ev->getFinalDamage(), $ev);
}
}
if($this->fireTicks > 0){
@@ -960,8 +963,8 @@ abstract class Entity extends Position implements Metadatable{
if($this->dead){
return;
}
$this->setHealth(0);
$this->dead = true;
$this->setHealth(0);
$this->scheduleUpdate();
}