protected function processChunkRequest() { if (count($this->chunkSendQueue) > 0) { $this->timings->syncChunkSendTimer->startTiming(); $x = null; $z = null; foreach ($this->chunkSendQueue as $index => $players) { if (isset($this->chunkSendTasks[$index])) { continue; } if (PHP_INT_SIZE === 8) { $x = $index >> 32 << 32 >> 32; $z = ($index & 4294967295.0) << 32 >> 32; } else { list($x, $z) = explode(":", $index); $x = (int) $x; $z = (int) $z; } if (ADVANCED_CACHE == true and ($cache = Cache::get("world:" . $this->getId() . ":" . $index)) !== false) { /** @var Player[] $players */ foreach ($players as $player) { if ($player->isConnected() and isset($player->usedChunks[$index])) { $player->sendChunk($x, $z, $cache); } } unset($this->chunkSendQueue[$index]); } else { $this->chunkSendTasks[$index] = true; $this->timings->syncChunkSendPrepareTimer->startTiming(); $task = $this->provider->requestChunkTask($x, $z); if ($task instanceof AsyncTask) { $this->server->getScheduler()->scheduleAsyncTask($task); } $this->timings->syncChunkSendPrepareTimer->stopTiming(); } } $this->timings->syncChunkSendTimer->stopTiming(); } }
protected function processChunkRequest() { if (count($this->chunkSendQueue) > 0) { $x = null; $z = null; foreach ($this->chunkSendQueue as $index => $players) { if (isset($this->chunkSendTasks[$index])) { continue; } Level::getXZ($index, $x, $z); if (ADVANCED_CACHE == true and ($cache = Cache::get("world:" . $this->getID() . ":" . $index)) !== false) { /** @var Player[] $players */ foreach ($players as $player) { if (isset($player->usedChunks[$index])) { $player->sendChunk($x, $z, $cache); } } unset($this->chunkSendQueue[$index]); } else { $this->chunkSendTasks[$index] = true; $task = $this->provider->requestChunkTask($x, $z); if ($task instanceof AsyncTask) { $this->server->getScheduler()->scheduleAsyncTask($task); } } } } }