diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index d64550516..8a8e5732c 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1140,6 +1140,20 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ Timings::$playerChunkOrderTimer->stopTiming(); } + public function doChunkRequests(){ + if(!$this->isOnline()){ + return; + } + + if($this->nextChunkOrderRun-- <= 0){ + $this->orderChunks(); + } + + if(count($this->loadQueue) > 0){ + $this->sendNextChunk(); + } + } + /** * @return Position */ @@ -1774,20 +1788,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->dataPacket($pk); } - public function checkNetwork(){ - if(!$this->isOnline()){ - return; - } - - if($this->nextChunkOrderRun-- <= 0){ - $this->orderChunks(); - } - - if(count($this->loadQueue) > 0){ - $this->sendNextChunk(); - } - } - /** * Returns whether the player can interact with the specified position. This checks distance and direction. * diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 3e7a46c64..e0b920ad1 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -2511,10 +2511,6 @@ class Server{ $this->checkTickUpdates($this->tickCounter, $tickTime); - foreach($this->players as $player){ - $player->checkNetwork(); - } - if(($this->tickCounter % 20) === 0){ if($this->doTitleTick){ $this->titleTick(); diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 0678230ff..4cd1281ce 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -787,7 +787,10 @@ class Level implements ChunkManager, Metadatable{ } - $this->processChunkRequest(); + foreach($this->players as $p){ + $p->doChunkRequests(); + } + $this->processChunkRequests(); if($this->sleepTicks > 0 and --$this->sleepTicks <= 0){ $this->checkSleep(); @@ -2464,7 +2467,7 @@ class Level implements ChunkManager, Metadatable{ } } - private function processChunkRequest(){ + private function processChunkRequests(){ if(count($this->chunkSendQueue) > 0){ $this->timings->syncChunkSendTimer->startTiming();