mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Added /invisible command
This commit is contained in:
@ -45,6 +45,26 @@ class ConsoleAPI{
|
||||
|
||||
public function defaultCommands($cmd, $params){
|
||||
switch($cmd){
|
||||
case "invisible":
|
||||
$p = strtolower(array_shift($params));
|
||||
switch($p){
|
||||
case "on":
|
||||
case "true":
|
||||
case "1":
|
||||
console("[INFO] Server is invisible");
|
||||
$this->server->api->setProperty("invisible", true);
|
||||
break;
|
||||
case "off":
|
||||
case "false":
|
||||
case "0":
|
||||
console("[INFO] Server is visible");
|
||||
$this->server->api->setProperty("invisible", false);
|
||||
break;
|
||||
default:
|
||||
console("[INFO] Usage: /invisible <on | off>");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "status":
|
||||
case "lag":
|
||||
$info = $this->server->debugInfo();
|
||||
@ -184,6 +204,7 @@ class ConsoleAPI{
|
||||
console("[INFO] /status: Show server TPS and memory usage");
|
||||
console("[INFO] /gamemode: Changes default gamemode");
|
||||
console("[INFO] /difficulty: Changes difficulty");
|
||||
console("[INFO] /invisible: Manages server visibility");
|
||||
console("[INFO] /say: Broadcasts mesages");
|
||||
console("[INFO] /save-all: Saves pending changes");
|
||||
console("[INFO] /whitelist: Manages whitelisting");
|
||||
|
@ -217,9 +217,13 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
|
||||
}else{
|
||||
$this->config["memory-limit"] = "256M";
|
||||
}
|
||||
if(!isset($this->config["invisible"])){
|
||||
$this->config["invisible"] = false;
|
||||
}
|
||||
if(is_object($this->server)){
|
||||
$this->server->setType($this->config["server-type"]);
|
||||
$this->server->timePerSecond = $this->config["time-per-second"];
|
||||
$this->server->invisible = $this->config["invisible"];
|
||||
$this->server->maxClients = $this->config["max-players"];
|
||||
$this->server->description = $this->config["description"];
|
||||
$this->server->motd = $this->config["motd"];
|
||||
@ -238,6 +242,7 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
|
||||
}
|
||||
$config = $this->config;
|
||||
$config["white-list"] = $config["white-list"] === true ? "true":"false";
|
||||
$config["invisible"] = $config["invisible"] === true ? "true":"false";
|
||||
$prop = "#Pocket Minecraft PHP server properties\r\n#".date("D M j H:i:s T Y")."\r\n";
|
||||
foreach($config as $n => $v){
|
||||
if($n == "spawn"){
|
||||
@ -304,6 +309,7 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
|
||||
$v = array("x" => floatval($v[0]), "y" => floatval($v[1]), "z" => floatval($v[2]));
|
||||
break;
|
||||
case "white-list":
|
||||
case "invisible":
|
||||
$v = trim($v) == "true" ? true:false;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user