mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-23 22:14:41 +00:00
Merge pull request #677 from Humerus/master
Enabled autosave via an option in server.properties.
This commit is contained in:
commit
87a67804c4
@ -84,6 +84,7 @@ class ServerAPI{
|
|||||||
"enable-rcon" => false,
|
"enable-rcon" => false,
|
||||||
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
|
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
|
||||||
"send-usage" => true,
|
"send-usage" => true,
|
||||||
|
"auto-save" => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->parseProperties();
|
$this->parseProperties();
|
||||||
@ -179,6 +180,10 @@ class ServerAPI{
|
|||||||
unset($this->asyncCalls[$id]);
|
unset($this->asyncCalls[$id]);
|
||||||
return $ob;
|
return $ob;
|
||||||
}
|
}
|
||||||
|
public function autoSave(){
|
||||||
|
console("[DEBUG] Saving....", true, true, 2);
|
||||||
|
$this->server->api->level->saveAll();
|
||||||
|
}
|
||||||
|
|
||||||
public function sendUsage(){
|
public function sendUsage(){
|
||||||
console("[DEBUG] Sending usage data...", true, true, 2);
|
console("[DEBUG] Sending usage data...", true, true, 2);
|
||||||
@ -279,7 +284,9 @@ class ServerAPI{
|
|||||||
$this->server->schedule(6000, array($this, "sendUsage"), array(), true); //Send the info after 5 minutes have passed
|
$this->server->schedule(6000, array($this, "sendUsage"), array(), true); //Send the info after 5 minutes have passed
|
||||||
$this->sendUsage();
|
$this->sendUsage();
|
||||||
}
|
}
|
||||||
|
if($this->getProperty("auto-save") === true){
|
||||||
|
$this->server->schedule(18000, array($this, "autoSave"), array(), true);
|
||||||
|
}
|
||||||
if($this->getProperty("enable-rcon") === true){
|
if($this->getProperty("enable-rcon") === true){
|
||||||
$this->rcon = new RCON($this->getProperty("rcon.password", ""), $this->getProperty("rcon.port", $this->getProperty("server-port")), ($ip = $this->getProperty("server-ip")) != "" ? $ip:"0.0.0.0", $this->getProperty("rcon.threads", 1), $this->getProperty("rcon.clients-per-thread", 50));
|
$this->rcon = new RCON($this->getProperty("rcon.password", ""), $this->getProperty("rcon.port", $this->getProperty("server-port")), ($ip = $this->getProperty("server-ip")) != "" ? $ip:"0.0.0.0", $this->getProperty("rcon.threads", 1), $this->getProperty("rcon.clients-per-thread", 50));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user