Added API method to get & set autosave interval

This commit is contained in:
Dylan K. Taylor 2019-04-26 18:01:40 +01:00
parent 6aa8276532
commit 7c7f42eba6

View File

@ -405,6 +405,25 @@ class LevelManager{
}
}
/**
* Returns the period after which loaded worlds will be automatically saved to disk.
*
* @return int
*/
public function getAutoSaveTicks() : int{
return $this->autoSaveTicks;
}
/**
* @param int $autoSaveTicks
*/
public function setAutoSaveTicks(int $autoSaveTicks) : void{
if($autoSaveTicks <= 0){
throw new \InvalidArgumentException("Autosave ticks must be positive");
}
$this->autoSaveTicks = $autoSaveTicks;
}
private function doAutoSave() : void{
Timings::$worldSaveTimer->startTiming();
foreach($this->levels as $level){