diff --git a/src/API/PlayerAPI.php b/src/API/PlayerAPI.php index 3aa857670..08e448234 100644 --- a/src/API/PlayerAPI.php +++ b/src/API/PlayerAPI.php @@ -463,7 +463,7 @@ class PlayerAPI{ $data = new Config(DATA_PATH."players/".$iname.".yml", CONFIG_YAML, $default); } - if(($this->server->gamemode & 0x01) === 0x01){ + if(($data->get("gamemode") & 0x01) === 1){ $data->set("health", 20); } $this->server->handle("player.offline.get", $data); diff --git a/src/Player.php b/src/Player.php index 9c780ff18..070eeefcc 100644 --- a/src/Player.php +++ b/src/Player.php @@ -248,6 +248,9 @@ class Player{ } } $this->data->set("armor", $armor); + if($this->entity instanceof Entity){ + $this->data->set("health", $this->entity->getHealth()); + } $this->data->set("gamemode", $this->gamemode); } } @@ -1220,7 +1223,8 @@ class Player{ case 1: //Spawn!! if($this->spawned !== false){ break; - } + } + $this->entity->setHealth($this->data->get("health")); $this->spawned = true; $this->server->api->player->spawnAllPlayers($this); $this->server->api->player->spawnToAllPlayers($this);