mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Level-independient time change
This commit is contained in:
@ -41,6 +41,14 @@ class Level{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function checkThings(){
|
||||
$now = microtime(true);
|
||||
$time = $this->startTime + ($now - $this->startCheck) * 20;
|
||||
if($this->server->api->dhandle("time.change", array("level" => $this, "time" => $time)) !== false){
|
||||
$this->time = $time;
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
$this->save();
|
||||
unset($this->level);
|
||||
@ -142,11 +150,6 @@ class Level{
|
||||
$this->startCheck = microtime(true);
|
||||
}
|
||||
|
||||
public function checkThings(){
|
||||
$now = microtime(true);
|
||||
$this->time = $this->startTime + ($now - $this->startCheck) * 20;
|
||||
}
|
||||
|
||||
public function getSeed(){
|
||||
return (int) $this->level->getData("seed");
|
||||
}
|
||||
|
Reference in New Issue
Block a user