Пример #1
0
 public static function init()
 {
     $server = ServerAPI::request();
     $id = 1;
     foreach (CraftingRecipes::$small as $recipe) {
         $recipe = CraftingRecipes::parseRecipe($recipe);
         $recipe[3] = 0;
         //Type
         CraftingRecipes::$recipes[$id] = $recipe;
         ++$id;
     }
     foreach (CraftingRecipes::$big as $recipe) {
         $recipe = CraftingRecipes::parseRecipe($recipe);
         $recipe[3] = 1;
         CraftingRecipes::$recipes[$id] = $recipe;
         ++$id;
     }
     foreach (CraftingRecipes::$stone as $recipe) {
         $recipe = CraftingRecipes::parseRecipe($recipe);
         $recipe[3] = 2;
         CraftingRecipes::$recipes[$id] = $recipe;
         ++$id;
     }
     foreach (CraftingRecipes::$recipes as $id => $recipe) {
         $server->query("INSERT INTO recipes (id, type, recipe) VALUES (" . $id . ", " . $recipe[3] . ", '" . $recipe[2] . "');");
     }
 }
Пример #2
0
 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;
 }