Fixed players can't join if spawn-radius is higher than the player's view distance

TODO: use this properly instead of calculating a count
This commit is contained in:
Dylan K. Taylor 2017-03-06 11:35:57 +00:00
parent c569fd86b1
commit d6d3184e37

View File

@ -429,6 +429,9 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
public function setViewDistance(int $distance){
$this->viewDistance = $this->server->getAllowedViewDistance($distance);
$this->spawnThreshold = (int) min($this->viewDistance, $this->server->getProperty("chunk-sending.spawn-radius")) ** 2 * M_PI;
$pk = new ChunkRadiusUpdatedPacket();
$pk->radius = $this->viewDistance;
$this->dataPacket($pk);