Force Entity health change on respawn

This commit is contained in:
Shoghi Cervantes 2014-02-01 01:06:05 +01:00
parent e619ebad61
commit 9cc624b74e
2 changed files with 4 additions and 5 deletions

View File

@ -1417,7 +1417,7 @@ class Player{
if($this->spawned !== false){
break;
}
$this->entity->setHealth($this->data->get("health"));
$this->entity->setHealth($this->data->get("health"), "spawn", true);
$this->spawned = true;
$this->server->api->player->spawnAllPlayers($this);
$this->server->api->player->spawnToAllPlayers($this);
@ -1849,9 +1849,8 @@ class Player{
if($this->entity instanceof Entity){
$this->entity->fire = 0;
$this->entity->air = 300;
$this->entity->setHealth(20, "respawn");
$this->entity->updateMetadata();
$this->entity->dead = false;
$this->entity->setHealth(20, "respawn", true);
$this->entity->updateMetadata();
}else{
break;
}

View File

@ -971,7 +971,7 @@ class Entity extends Position{
}else{
return false; //Entity inmunity
}
}elseif($health === $this->health){
}elseif($health === $this->health and !$this->dead){
return false;
}
if($this->server->api->dhandle("entity.health.change", array("entity" => $this, "eid" => $this->eid, "health" => $health, "cause" => $cause)) !== false or $force === true){