From 82c72f8beb2d09da80bb6d37dc88578708408f2f Mon Sep 17 00:00:00 2001 From: Michael Yoo Date: Sat, 20 Apr 2013 12:26:26 +0930 Subject: [PATCH] Added defaultgamemode command --- src/API/ConsoleAPI.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/API/ConsoleAPI.php b/src/API/ConsoleAPI.php index 0760d1bc1..3898fac2e 100644 --- a/src/API/ConsoleAPI.php +++ b/src/API/ConsoleAPI.php @@ -46,6 +46,7 @@ class ConsoleAPI{ $this->register("say", "", array($this, "defaultCommands")); $this->register("save-all", "", array($this, "defaultCommands")); $this->register("stop", "", array($this, "defaultCommands")); + $this->register("defaultgamemode", "", array($this, "defaultCommands")); $this->server->api->ban->cmdWhitelist("help"); } @@ -59,6 +60,30 @@ class ConsoleAPI{ public function defaultCommands($cmd, $params, $issuer, $alias){ $output = ""; switch($cmd){ + case "defaultgamemode": + $p = strtolower(array_shift($params)); + switch($p){ + case "creative": + $output .= "Default Gamemode is now Creative\n"; + $this->server->gamemode = CREATIVE; + break; + case "survival": + $output .= "Default Gamemode is now Survival\n"; + $this->server->gamemode = SURVIVAL; + break; + case "adventure": + $output .= "Default Gamemode is now Adventure\n"; + $this->server->gamemode = ADVENTURE; + break; + case "view": + $output .= "Default Gamemode is now View\n"; + $this->server->gamemode = VIEW; + break; + default: + $output .= "Usage: /defaultgamemode \n"; + break; + } + break; case "invisible": $p = strtolower(array_shift($params)); switch($p){