Fixed possible Player crash on save

This commit is contained in:
Shoghi Cervantes 2014-09-05 10:50:19 +02:00
parent 98e0583f34
commit d3c308c5a8

View File

@ -2222,6 +2222,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
}
parent::saveNBT();
if($this->getLevel() instanceof Level){
$this->namedtag["Level"] = $this->getLevel()->getName();
if($this->spawnPosition instanceof Position and $this->spawnPosition->getLevel() instanceof Level){
$this->namedtag["SpawnLevel"] = $this->spawnPosition->getLevel()->getName();
@ -2241,6 +2242,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->server->saveOfflinePlayerData($this->username, $this->namedtag);
}
}
}
/**
* Gets the username