NetworkSession: don't crash on teleporting to other world during PlayerLoginEvent

This commit is contained in:
Dylan K. Taylor 2021-05-07 22:47:06 +01:00
parent 5324474194
commit f9bfc0df73
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -942,11 +942,13 @@ class NetworkSession{
}
public function onEnterWorld() : void{
$world = $this->player->getWorld();
$this->syncWorldTime($world->getTime());
$this->syncWorldDifficulty($world->getDifficulty());
//TODO: weather needs to be synced here (when implemented)
//TODO: world spawn needs to be synced here
if($this->player !== null){
$world = $this->player->getWorld();
$this->syncWorldTime($world->getTime());
$this->syncWorldDifficulty($world->getDifficulty());
//TODO: weather needs to be synced here (when implemented)
//TODO: world spawn needs to be synced here
}
}
public function syncWorldTime(int $worldTime) : void{