Fixed #748 Player health not being saved [gh#748]

This commit is contained in:
Shoghi Cervantes 2013-08-26 10:01:12 +02:00
parent 30483d5312
commit 7865b8dbe5
2 changed files with 6 additions and 2 deletions

View File

@ -463,7 +463,7 @@ class PlayerAPI{
$data = new Config(DATA_PATH."players/".$iname.".yml", CONFIG_YAML, $default); $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); $data->set("health", 20);
} }
$this->server->handle("player.offline.get", $data); $this->server->handle("player.offline.get", $data);

View File

@ -248,6 +248,9 @@ class Player{
} }
} }
$this->data->set("armor", $armor); $this->data->set("armor", $armor);
if($this->entity instanceof Entity){
$this->data->set("health", $this->entity->getHealth());
}
$this->data->set("gamemode", $this->gamemode); $this->data->set("gamemode", $this->gamemode);
} }
} }
@ -1221,6 +1224,7 @@ class Player{
if($this->spawned !== false){ if($this->spawned !== false){
break; break;
} }
$this->entity->setHealth($this->data->get("health"));
$this->spawned = true; $this->spawned = true;
$this->server->api->player->spawnAllPlayers($this); $this->server->api->player->spawnAllPlayers($this);
$this->server->api->player->spawnToAllPlayers($this); $this->server->api->player->spawnToAllPlayers($this);