コード例 #1
0
ファイル: ServerAPI.php プロジェクト: ungarscool1/Multicraft
 public function init()
 {
     if (!self::$serverRequest instanceof PocketMinecraftServer) {
         self::$serverRequest = $this->server;
     }
     if ($this->getProperty("send-usage") !== false) {
         $this->server->schedule(6000, array($this, "sendUsage"), array(), true);
         //Send the info after 5 minutes have passed
         $this->sendUsage();
     }
     if ($this->getProperty("auto-save") === true) {
         $this->server->schedule(18000, array($this, "autoSave"), array(), true);
     }
     if (!defined("NO_THREADS") and $this->getProperty("enable-rcon") === true) {
         $this->rcon = new RCON($this->getProperty("rcon.password", ""), $this->getProperty("rcon.port", $this->getProperty("server-port")), ($ip = $this->getProperty("server-ip")) != "" ? $ip : "0.0.0.0", $this->getProperty("rcon.threads", 1), $this->getProperty("rcon.clients-per-thread", 50));
     }
     if ($this->getProperty("enable-query") === true) {
         $this->query = new QueryHandler();
     }
     CraftingRecipes::init();
     $this->server->init();
     unregister_tick_function(array($this->server, "tick"));
     $this->console->__destruct();
     if ($this->rcon instanceof RCON) {
         $this->rcon->stop();
     }
     $this->__destruct();
     if ($this->getProperty("upnp-forwarding") === true) {
         console("[INFO] [UPnP] Removing port forward...");
         UPnP_RemovePortForward($this->getProperty("server-port"));
     }
     return $this->restart;
 }