Added player commands, better console API and implemented future player chat

This commit is contained in:
Shoghi Cervantes Pueyo 2013-02-07 09:23:37 +01:00
parent 72388fa3cb
commit c2e55941d8
6 changed files with 186 additions and 131 deletions

View file

@ -41,13 +41,14 @@ class TimeAPI{
$this->server->api->console->register("time", "Manages server time", array($this, "commandHandler"));
}
public function commandHandler($cmd, $params){
public function commandHandler($cmd, $params, $issuer){
$output = "";
switch($cmd){
case "time":
$p = strtolower(array_shift($params));
switch($p){
case "check":
console("[INFO] Time: ".$this->getDate().", ".$this->getPhase()." (".$this->get(true).")");
$output .= "Time: ".$this->getDate().", ".$this->getPhase()." (".$this->get(true).")\n";
break;
case "add":
$this->add(array_shift($params));
@ -68,11 +69,12 @@ class TimeAPI{
$this->night();
break;
default:
console("[INFO] Usage: /time <check | set | add | sunrise | day | sunset | night> [time]");
$output .= "Usage: /time <check | set | add | sunrise | day | sunset | night> [time]\n";
break;
}
break;
}
return $output;
}
public function night(){