mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Anvil fixes, improved memory settings
This commit is contained in:
@ -33,10 +33,12 @@ class LowMemoryEvent extends ServerEvent{
|
||||
private $memory;
|
||||
private $memoryLimit;
|
||||
private $triggerCount;
|
||||
private $global;
|
||||
|
||||
public function __construct($memory, $memoryLimit, $triggerCount = 0){
|
||||
public function __construct($memory, $memoryLimit, $isGlobal = false, $triggerCount = 0){
|
||||
$this->memory = $memory;
|
||||
$this->memoryLimit = $memoryLimit;
|
||||
$this->global = (bool) $isGlobal;
|
||||
$this->triggerCount = (int) $triggerCount;
|
||||
}
|
||||
|
||||
@ -67,13 +69,20 @@ class LowMemoryEvent extends ServerEvent{
|
||||
return $this->triggerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isGlobal(){
|
||||
return $this->global;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount of memory already freed
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMemoryFreed(){
|
||||
return $this->getMemory() - Utils::getMemoryUsage();
|
||||
return $this->getMemory() - ($this->isGlobal() ? Utils::getMemoryUsage(true)[1] : Utils::getMemoryUsage(true)[0]);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user