mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
Fixed crashes due to adding players 'online' far too early, fixed some Player save logic
This commit is contained in:
parent
b5f473a3df
commit
7f838a8c36
@ -1797,7 +1797,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$this->sendPlayStatus(PlayStatusPacket::LOGIN_SUCCESS);
|
||||
|
||||
$this->loggedIn = true;
|
||||
$this->server->addOnlinePlayer($this);
|
||||
|
||||
$pk = new ResourcePacksInfoPacket();
|
||||
$manager = $this->server->getResourceManager();
|
||||
@ -1876,6 +1875,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
|
||||
$this->forceMovement = $this->teleportPosition = $this->getPosition();
|
||||
|
||||
$this->server->addOnlinePlayer($this);
|
||||
|
||||
$this->server->onPlayerLogin($this);
|
||||
}
|
||||
|
||||
@ -3637,15 +3638,17 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
}
|
||||
|
||||
parent::saveNBT();
|
||||
if($this->getLevel() instanceof Level){
|
||||
|
||||
if($this->isValid()){
|
||||
$this->namedtag->Level = new StringTag("Level", $this->level->getFolderName());
|
||||
}
|
||||
|
||||
if($this->hasValidSpawnPosition()){
|
||||
$this->namedtag["SpawnLevel"] = $this->spawnPosition->getLevel()->getFolderName();
|
||||
$this->namedtag["SpawnX"] = (int) $this->spawnPosition->x;
|
||||
$this->namedtag["SpawnY"] = (int) $this->spawnPosition->y;
|
||||
$this->namedtag["SpawnZ"] = (int) $this->spawnPosition->z;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($this->achievements as $achievement => $status){
|
||||
$this->namedtag->Achievements[$achievement] = new ByteTag($achievement, $status === true ? 1 : 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user