Fixed world spawn point not updating to players (#4699)

closes #4383
This commit is contained in:
Covered123 2022-01-04 17:31:27 -03:00 committed by GitHub
parent 7bee72ef2d
commit aeab19a616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2258,6 +2258,11 @@ class World implements ChunkManager{
$previousSpawn = $this->getSpawnLocation();
$this->provider->getWorldData()->setSpawn($pos);
(new SpawnChangeEvent($this, $previousSpawn))->call();
$location = Position::fromObject($pos, $this);
foreach($this->players as $player){
$player->getNetworkSession()->syncWorldSpawnPoint($location);
}
}
/**