mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
Scheduled saving
This commit is contained in:
parent
244fde8143
commit
f1e4bb0f62
@ -133,7 +133,7 @@ class Player{
|
||||
return false;
|
||||
}
|
||||
$c = key($this->chunksOrder);
|
||||
$d = $this->chunksOrder[$c];
|
||||
$d = @$this->chunksOrder[$c];
|
||||
if($c === null or $d > $this->server->api->getProperty("view-distance")){
|
||||
if($this->freedChunks === false){
|
||||
foreach($this->chunksOrder as $c => $d){
|
||||
|
@ -224,6 +224,9 @@ class PMFLevel extends PMF{
|
||||
}elseif($save !== false){
|
||||
$this->saveChunk($X, $Z);
|
||||
}
|
||||
$index = $this->getIndex($X, $Z);
|
||||
$this->chunks[$index] = null;
|
||||
$this->chunkChange[$index] = null;
|
||||
unset($this->chunks[$index], $this->chunkChange[$index]);
|
||||
return true;
|
||||
}
|
||||
|
@ -35,7 +35,8 @@ class Level{
|
||||
$this->entities = $entities;
|
||||
$this->tileEntities = $tileEntities;
|
||||
$this->startTime = $this->time = (int) $this->level->getData("time");
|
||||
$this->startCheck = microtime(true);
|
||||
$this->lastSave = $this->startCheck = microtime(true);
|
||||
$this->nextSave += 30;
|
||||
$this->server->schedule(15, array($this, "checkThings"), array(), true);
|
||||
$this->server->event("server.close", array($this, "save"));
|
||||
$this->name = $name;
|
||||
@ -74,6 +75,11 @@ class Level{
|
||||
$this->level->unloadChunk((int) $X, (int) $Z);
|
||||
}
|
||||
}
|
||||
|
||||
if($this->lastSave < $now){
|
||||
$this->save();
|
||||
$this->lastSave = $now + 30;
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user