From 9cc624b74e5cdfa4749fdda10213070fc576b603 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 1 Feb 2014 01:06:05 +0100 Subject: [PATCH] Force Entity health change on respawn --- src/Player.php | 7 +++---- src/world/Entity.php | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Player.php b/src/Player.php index 5d5826ff3..6b52ddd17 100644 --- a/src/Player.php +++ b/src/Player.php @@ -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; } diff --git a/src/world/Entity.php b/src/world/Entity.php index a550542db..f477718af 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -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){