World: renamed getChunks() to getLoadedChunks() (#4393)

This commit is contained in:
Colin 2021-08-23 22:23:35 +02:00 committed by GitHub
parent 2d025bf02f
commit 224d71f272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -54,10 +54,10 @@ class GarbageCollectorCommand extends VanillaCommand{
$memory = memory_get_usage(); $memory = memory_get_usage();
foreach($sender->getServer()->getWorldManager()->getWorlds() as $world){ foreach($sender->getServer()->getWorldManager()->getWorlds() as $world){
$diff = [count($world->getChunks()), count($world->getEntities())]; $diff = [count($world->getLoadedChunks()), count($world->getEntities())];
$world->doChunkGarbageCollection(); $world->doChunkGarbageCollection();
$world->unloadChunks(true); $world->unloadChunks(true);
$chunksCollected += $diff[0] - count($world->getChunks()); $chunksCollected += $diff[0] - count($world->getLoadedChunks());
$entitiesCollected += $diff[1] - count($world->getEntities()); $entitiesCollected += $diff[1] - count($world->getEntities());
$world->clearCache(true); $world->clearCache(true);
} }

View File

@ -113,7 +113,7 @@ class StatusCommand extends VanillaCommand{
$worldName = $world->getFolderName() !== $world->getDisplayName() ? " (" . $world->getDisplayName() . ")" : ""; $worldName = $world->getFolderName() !== $world->getDisplayName() ? " (" . $world->getDisplayName() . ")" : "";
$timeColor = $world->getTickRateTime() > 40 ? TextFormat::RED : TextFormat::YELLOW; $timeColor = $world->getTickRateTime() > 40 ? TextFormat::RED : TextFormat::YELLOW;
$sender->sendMessage(TextFormat::GOLD . "World \"{$world->getFolderName()}\"$worldName: " . $sender->sendMessage(TextFormat::GOLD . "World \"{$world->getFolderName()}\"$worldName: " .
TextFormat::RED . number_format(count($world->getChunks())) . TextFormat::GREEN . " chunks, " . TextFormat::RED . number_format(count($world->getLoadedChunks())) . TextFormat::GREEN . " chunks, " .
TextFormat::RED . number_format(count($world->getEntities())) . TextFormat::GREEN . " entities. " . TextFormat::RED . number_format(count($world->getEntities())) . TextFormat::GREEN . " entities. " .
"Time $timeColor" . round($world->getTickRateTime(), 2) . "ms" "Time $timeColor" . round($world->getTickRateTime(), 2) . "ms"
); );

View File

@ -2035,7 +2035,7 @@ class World implements ChunkManager{
/** /**
* @return Chunk[] * @return Chunk[]
*/ */
public function getChunks() : array{ public function getLoadedChunks() : array{
return $this->chunks; return $this->chunks;
} }