mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
health regeneration cancelled when dead
This commit is contained in:
parent
a0cb4d2698
commit
26da585889
2 changed files with 9 additions and 6 deletions
|
|
@ -46,8 +46,11 @@ class PlayerAPI{
|
|||
$result = $this->server->query("SELECT EID FROM players WHERE EID = (SELECT EID FROM entities WHERE health < 20);");
|
||||
if($result !== true and $result !== false){
|
||||
while(false !== ($player = $result->fetchArray())){
|
||||
if(($player = $this->server->api->player->getByEID($player["EID"])) !== false){
|
||||
$player->entity->setHealth(min(20, $player->entity->getHealth() + $data), "regeneration");
|
||||
if(($player = $this->server->api->entity->get($player["EID"])) !== false){
|
||||
if($player->dead === true){
|
||||
continue;
|
||||
}
|
||||
$player->setHealth(min(20, $player->entity->getHealth() + $data), "regeneration");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue