mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-30 23:29:54 +00:00
Added API method to get & set autosave interval
This commit is contained in:
parent
6aa8276532
commit
7c7f42eba6
@ -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){
|
||||
|
Loading…
x
Reference in New Issue
Block a user