Server restart without closing, added more info

This commit is contained in:
Shoghi Cervantes Pueyo 2012-12-12 00:07:55 +01:00
parent 29d253fd93
commit fb019a88c1
6 changed files with 26 additions and 9 deletions

View file

@ -45,7 +45,12 @@ class ConsoleAPI{
$this->server->api->setProperty("last-update", time());
break;
case "stop":
console("[INFO] Stopping server...");
console("[INFO] Stopping the server...");
$this->server->close();
break;
case "restart":
console("[INFO] Restarting the server...");
$this->server->api->restart = true;
$this->server->close();
break;
case "banip":
@ -174,6 +179,7 @@ class ConsoleAPI{
console("[INFO] /whitelist: Manages whitelisting");
console("[INFO] /banip: Manages IP ban");
console("[INFO] /stop: Stops the server");
console("[INFO] /restart: Restarts the server");
foreach($this->help as $c => $h){
console("[INFO] /$c: ".$h[0]);
}

View file

@ -49,7 +49,7 @@ class PlayerAPI{
case "list":
console("[INFO] Player list:");
foreach($this->server->clients as $c){
console("[INFO] ".$c->username." (".$c->ip.":".$c->port."), ClientID ".$c->clientID);
console("[INFO] ".$c->username." (".$c->ip.":".$c->port."), ClientID ".$c->clientID.", (".round($c->username->entity->position["x"], 2).", ".round($c->username->entity->position["y"], 2).", ".round($c->username->entity->position["z"], 2).")");
}
break;
}

View file

@ -26,7 +26,7 @@ the Free Software Foundation, either version 3 of the License, or
*/
class ServerAPI extends stdClass{ //Yay! I can add anything to this class in runtime!
var $server;
var $server, $restart = false;
private $config, $apiList = array();
function __construct(){
console("[INFO] Starting ServerAPI server handler...");
@ -260,6 +260,7 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
public function start(){
$this->server->start();
return $this->restart;
}