From bf68a6a9fc5adf7dbd1422c9707f9e7109f1582c Mon Sep 17 00:00:00 2001 From: xFlare Date: Tue, 3 Oct 2017 15:27:53 -0400 Subject: [PATCH] Fixed canUseChunkCache() logic (#1446) Fix setting disable chunk cache on low memory being useless, fix chunk cache not working if low memory cache clear is enabled --- src/pocketmine/MemoryManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/MemoryManager.php b/src/pocketmine/MemoryManager.php index 204e24986..f2016d92e 100644 --- a/src/pocketmine/MemoryManager.php +++ b/src/pocketmine/MemoryManager.php @@ -72,7 +72,7 @@ class MemoryManager{ private $chunkTrigger; /** @var bool */ - private $chunkCache; + private $disableChunkCacheOnLowMemory; /** @var bool */ private $cacheTrigger; @@ -133,7 +133,7 @@ class MemoryManager{ $this->chunkCollect = (bool) $this->server->getProperty("memory.max-chunks.trigger-chunk-collect", true); $this->chunkTrigger = (bool) $this->server->getProperty("memory.max-chunks.low-memory-trigger", true); - $this->chunkCache = (bool) $this->server->getProperty("memory.world-caches.disable-chunk-cache", true); + $this->disableChunkCacheOnLowMemory = (bool) $this->server->getProperty("memory.world-caches.disable-chunk-cache", true); $this->cacheTrigger = (bool) $this->server->getProperty("memory.world-caches.low-memory-trigger", true); $this->dumpWorkers = (bool) $this->server->getProperty("memory.memory-dump.dump-async-worker", true); @@ -151,7 +151,7 @@ class MemoryManager{ * @return bool */ public function canUseChunkCache() : bool{ - return !($this->lowMemory and $this->chunkTrigger); + return !$this->lowMemory or !$this->disableChunkCacheOnLowMemory; } /**