From 51548d1a27a1e827933c6c35dcc8221741d57038 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 7 May 2019 18:51:26 +0100 Subject: [PATCH] World: remove useless internal function this just complicates the logic for no reason. It had a purpose once, but no longer. --- src/pocketmine/world/World.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/pocketmine/world/World.php b/src/pocketmine/world/World.php index a18d03da69..b97ab5ccac 100644 --- a/src/pocketmine/world/World.php +++ b/src/pocketmine/world/World.php @@ -2416,16 +2416,6 @@ class World implements ChunkManager, Metadatable{ $this->chunkSendQueue[$index][spl_object_id($player)] = $player; } - private function onChunkReady(int $x, int $z){ - if(isset($this->chunkSendQueue[$index = World::chunkHash($x, $z)])){ - foreach($this->chunkSendQueue[$index] as $player){ - /** @var Player $player */ - $player->onChunkReady($x, $z); - } - unset($this->chunkSendQueue[$index]); - } - } - private function processChunkRequests(){ if(count($this->chunkSendQueue) > 0){ $this->timings->syncChunkSendTimer->startTiming(); @@ -2439,10 +2429,16 @@ class World implements ChunkManager, Metadatable{ if($chunk === null or !$chunk->isGenerated() or !$chunk->isPopulated()){ throw new ChunkException("Invalid Chunk sent"); } - $this->onChunkReady($x, $z); + + foreach($players as $player){ + $player->onChunkReady($x, $z); + } + $this->timings->syncChunkSendPrepareTimer->stopTiming(); } + $this->chunkSendQueue = []; + $this->timings->syncChunkSendTimer->stopTiming(); } }