Ejemplo n.º 1
0
 /**
  * Starts the PocketMine-MP server and starts processing ticks and packets
  */
 public function start()
 {
     if ($this->getConfigBoolean("enable-query", true) === true) {
         $this->queryHandler = new QueryHandler();
     }
     foreach ($this->getIPBans()->getEntries() as $entry) {
         $this->network->blockAddress($entry->getName(), -1);
     }
     if ($this->getProperty("settings.send-usage", true) !== false) {
         $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "sendUsage"]), 6000, 6000);
         $this->sendUsage();
     }
     if ($this->getProperty("settings.upnp-forwarding", false) == true) {
         $this->logger->info("[UPnP] Trying to port forward...");
         UPnP::PortForward($this->getPort());
     }
     $this->tickCounter = 0;
     if (function_exists("pcntl_signal")) {
         pcntl_signal(SIGTERM, [$this, "handleSignal"]);
         pcntl_signal(SIGINT, [$this, "handleSignal"]);
         pcntl_signal(SIGHUP, [$this, "handleSignal"]);
         $this->getScheduler()->scheduleRepeatingTask(new CallbackTask("pcntl_signal_dispatch"), 5);
     }
     $this->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this, "checkTicks"]), 20 * 5);
     $this->logger->info("Default game type: " . self::getGamemodeString($this->getGamemode()));
     Effect::init();
     $this->logger->info("Done (" . round(microtime(true) - \pocketmine\START_TIME, 3) . 's)! For help, type "help" or "?"');
     $this->tickProcessor();
     $this->forceShutdown();
     \gc_collect_cycles();
 }
Ejemplo n.º 2
0
 /**
  * Starts the PocketMine-MP server and starts processing ticks and packets
  */
 public function start()
 {
     if ($this->getConfigBoolean("enable-query", true) === true) {
         $this->queryHandler = new QueryHandler();
     }
     foreach ($this->getIPBans()->getEntries() as $entry) {
         $this->network->blockAddress($entry->getName(), -1);
     }
     if ($this->getProperty("settings.send-usage", true)) {
         $this->sendUsageTicker = 6000;
         $this->sendUsage(SendUsageTask::TYPE_OPEN);
     }
     if ($this->getProperty("network.upnp-forwarding", false) == true) {
         $this->logger->info("[UPnP] Trying to port forward...");
         UPnP::PortForward($this->getPort());
     }
     $this->tickCounter = 0;
     if (function_exists("pcntl_signal")) {
         pcntl_signal(SIGTERM, [$this, "handleSignal"]);
         pcntl_signal(SIGINT, [$this, "handleSignal"]);
         pcntl_signal(SIGHUP, [$this, "handleSignal"]);
         $this->dispatchSignals = true;
     }
     $this->logger->info($this->getLanguage()->translateString("pocketmine.server.defaultGameMode", [self::getGamemodeString($this->getGamemode())]));
     $this->logger->info($this->getLanguage()->translateString("pocketmine.server.startFinished", [round(microtime(true) - \pocketmine\START_TIME, 3)]));
     $this->tickProcessor();
     $this->forceShutdown();
     gc_collect_cycles();
 }
Ejemplo n.º 3
0
 /**
  * Starts the Katana server and starts processing ticks and packets
  */
 public function start()
 {
     if ($this->getConfigBoolean("enable-query", true) === true) {
         $this->queryHandler = new QueryHandler();
     }
     foreach ($this->getIPBans()->getEntries() as $entry) {
         $this->network->blockAddress($entry->getName(), -1);
     }
     if ($this->getProperty("network.upnp-forwarding", false) == true) {
         $this->katana->console->system("[UPnP] Trying to port forward...");
         UPnP::PortForward($this->getPort());
     }
     $this->tickCounter = 0;
     if (function_exists("pcntl_signal")) {
         pcntl_signal(SIGTERM, [$this, "handleSignal"]);
         pcntl_signal(SIGINT, [$this, "handleSignal"]);
         pcntl_signal(SIGHUP, [$this, "handleSignal"]);
         $this->dispatchSignals = true;
     }
     $this->katana->console->system(Terminal::$COLOR_WHITE . "Done (" . round(microtime(true) - \pocketmine\START_TIME, 3) . "s)! " . Terminal::$COLOR_GRAY . "For help, type \"help\" or \"?\"");
     $this->tickProcessor();
     $this->forceShutdown();
     gc_collect_cycles();
 }