mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 05:15:13 +00:00
Added TimeAPI command responses
This commit is contained in:
parent
02bbfb60b6
commit
6457055be3
@ -51,22 +51,16 @@ class TimeAPI{
|
|||||||
$output .= "Time: ".$this->getDate().", ".$this->getPhase()." (".$this->get(true).")\n";
|
$output .= "Time: ".$this->getDate().", ".$this->getPhase()." (".$this->get(true).")\n";
|
||||||
break;
|
break;
|
||||||
case "add":
|
case "add":
|
||||||
$this->add(array_shift($params));
|
$output .= "Set the time to ".$this->add(array_shift($params))."\n";
|
||||||
break;
|
break;
|
||||||
case "set":
|
case "set":
|
||||||
$this->set(array_shift($params));
|
$output .= "Set the time to ".$this->set(array_shift($params))."\n";
|
||||||
break;
|
break;
|
||||||
case "sunrise":
|
case "sunrise":
|
||||||
$this->sunrise();
|
|
||||||
break;
|
|
||||||
case "day":
|
case "day":
|
||||||
$this->day();
|
|
||||||
break;
|
|
||||||
case "sunset":
|
case "sunset":
|
||||||
$this->sunset();
|
|
||||||
break;
|
|
||||||
case "night":
|
case "night":
|
||||||
$this->night();
|
$output .= "Set the time to ".$this->set($p)."\n";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$output .= "Usage: /time <check|set|add> [time]\n";
|
$output .= "Usage: /time <check|set|add> [time]\n";
|
||||||
@ -78,16 +72,16 @@ class TimeAPI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function night(){
|
public function night(){
|
||||||
$this->set("night");
|
return $this->set("night");
|
||||||
}
|
}
|
||||||
public function day(){
|
public function day(){
|
||||||
$this->set("day");
|
return $this->set("day");
|
||||||
}
|
}
|
||||||
public function sunrise(){
|
public function sunrise(){
|
||||||
$this->set("sunrise");
|
return $this->set("sunrise");
|
||||||
}
|
}
|
||||||
public function sunset(){
|
public function sunset(){
|
||||||
$this->set("sunset");
|
return $this->set("sunset");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get($raw = false){
|
public function get($raw = false){
|
||||||
@ -96,6 +90,7 @@ class TimeAPI{
|
|||||||
|
|
||||||
public function add($time){
|
public function add($time){
|
||||||
$this->server->time += (int) $time;
|
$this->server->time += (int) $time;
|
||||||
|
return $this->server->time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDate($time = false){
|
public function getDate($time = false){
|
||||||
@ -123,6 +118,7 @@ class TimeAPI{
|
|||||||
}else{
|
}else{
|
||||||
$this->server->time = (int) $time;
|
$this->server->time = (int) $time;
|
||||||
}
|
}
|
||||||
|
return $this->server->time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user