Fixed logic for low memory chunk radius override

This commit is contained in:
Dylan K. Taylor 2017-10-11 13:40:13 +01:00
parent 8d095dff6c
commit 59d9d6a7df
2 changed files with 3 additions and 8 deletions

View File

@ -131,7 +131,6 @@ class MemoryManager{
$this->lowMemChunkRadiusOverride = (int) $this->server->getProperty("memory.max-chunks.chunk-radius", 4);
$this->lowMemChunkGC = (bool) $this->server->getProperty("memory.max-chunks.trigger-chunk-collect", true);
$this->lowMemReduceChunkRadius = (bool) $this->server->getProperty("memory.max-chunks.low-memory-trigger", true);
$this->lowMemDisableChunkCache = (bool) $this->server->getProperty("memory.world-caches.disable-chunk-cache", true);
$this->lowMemClearWorldCache = (bool) $this->server->getProperty("memory.world-caches.low-memory-trigger", true);
@ -162,7 +161,7 @@ class MemoryManager{
* @return int
*/
public function getViewDistance(int $distance) : int{
return $this->lowMemory ? (int) min($this->lowMemChunkRadiusOverride, $distance) : $distance;
return ($this->lowMemory and $this->lowMemChunkRadiusOverride > 0) ? (int) min($this->lowMemChunkRadiusOverride, $distance) : $distance;
}
/**
@ -182,7 +181,7 @@ class MemoryManager{
}
}
if($this->lowMemReduceChunkRadius and $this->lowMemChunkGC){
if($this->lowMemChunkGC){
foreach($this->server->getLevels() as $level){
$level->doChunkGarbageCollection();
}

View File

@ -67,17 +67,13 @@ memory:
#Dump memory from async workers as well as the main thread. If you have issues with segfaults when dumping memory, disable this setting.
dump-async-worker: true
max-chunks:
#Maximum render distance per player when low memory is triggered
#Cap maximum render distance per player when low memory is triggered. Set to 0 to disable cap.
chunk-radius: 4
#Do chunk garbage collection on trigger
trigger-chunk-collect: true
#Trigger on low memory
low-memory-trigger: true
world-caches:
#Disallow adding to world chunk-packet caches when memory is low
disable-chunk-cache: true