mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
Level-independient time change
This commit is contained in:
parent
e63677a23d
commit
5ee2cda4a6
4 changed files with 17 additions and 14 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue