RemovePortForward() публичный статический Метод

public static RemovePortForward ( $port )
Пример #1
0
 public function forceShutdown()
 {
     if ($this->hasStopped) {
         return;
     }
     try {
         $this->hasStopped = true;
         $this->shutdown();
         if ($this->rcon instanceof RCON) {
             $this->rcon->stop();
         }
         if ($this->getProperty("settings.upnp-forwarding", false) === true) {
             $this->logger->info("[UPnP] Removing port forward...");
             UPnP::RemovePortForward($this->getPort());
         }
         $this->pluginManager->disablePlugins();
         foreach ($this->players as $player) {
             $player->close(TextFormat::YELLOW . $player->getName() . " has left the game", $this->getProperty("settings.shutdown-message", "Server closed"));
         }
         foreach ($this->getLevels() as $level) {
             $this->unloadLevel($level, true);
         }
         if ($this->generationManager instanceof GenerationRequestManager) {
             $this->generationManager->shutdown();
         }
         HandlerList::unregisterAll();
         $this->scheduler->cancelAllTasks();
         $this->scheduler->mainThreadHeartbeat(PHP_INT_MAX);
         $this->properties->save();
         $this->console->kill();
         foreach ($this->network->getInterfaces() as $interface) {
             $interface->shutdown();
             $this->network->unregisterInterface($interface);
         }
     } catch (\Exception $e) {
         $this->logger->emergency("Crashed while crashing, killing process");
         @kill(getmypid());
     }
 }
Пример #2
0
 public function forceShutdown()
 {
     if ($this->hasStopped) {
         return;
     }
     try {
         if (!$this->isRunning()) {
             $this->sendUsage(SendUsageTask::TYPE_CLOSE);
         }
         $this->hasStopped = true;
         $this->shutdown();
         if ($this->rcon instanceof RCON) {
             $this->rcon->stop();
         }
         if ($this->getProperty("network.upnp-forwarding", false) === true) {
             $this->logger->info("[UPnP] Removing port forward...");
             UPnP::RemovePortForward($this->getPort());
         }
         $this->getLogger()->debug("Disabling all plugins");
         $this->pluginManager->disablePlugins();
         foreach ($this->players as $player) {
             $player->close($player->getLeaveMessage(), $this->getProperty("settings.shutdown-message", "Server closed"));
         }
         $this->getLogger()->debug("Unloading all levels");
         foreach ($this->getLevels() as $level) {
             $this->unloadLevel($level, true);
         }
         $this->getLogger()->debug("Removing event handlers");
         HandlerList::unregisterAll();
         $this->getLogger()->debug("Stopping all tasks");
         $this->scheduler->cancelAllTasks();
         $this->scheduler->mainThreadHeartbeat(PHP_INT_MAX);
         $this->getLogger()->debug("Saving properties");
         $this->properties->save();
         $this->getLogger()->debug("Closing console");
         $this->console->kill();
         $this->getLogger()->debug("Stopping network interfaces");
         foreach ($this->network->getInterfaces() as $interface) {
             $interface->shutdown();
             $this->network->unregisterInterface($interface);
         }
         $this->memoryManager->doObjectCleanup();
         gc_collect_cycles();
     } catch (\Exception $e) {
         $this->logger->emergency("Crashed while crashing, killing process");
         @kill(getmypid());
     }
 }
Пример #3
0
 public function forceShutdown()
 {
     if ($this->hasStopped) {
         return;
     }
     try {
         $this->hasStopped = true;
         $this->shutdown();
         if ($this->rcon instanceof RCON) {
             $this->rcon->stop();
         }
         if ($this->getProperty("network.upnp-forwarding", false) === true) {
             $this->katana->console->system("[UPnP] Removing port forward...");
             UPnP::RemovePortForward($this->getPort());
         }
         $this->katana->console->system(Terminal::$COLOR_GRAY . "Disabling all plugins");
         $this->pluginManager->disablePlugins();
         foreach ($this->players as $player) {
             $player->close($player->getLeaveMessage(), $this->getProperty("settings.shutdown-message", "Server closed"));
         }
         $this->katana->console->system(Terminal::$COLOR_GRAY . "Unloading all levels");
         foreach ($this->getLevels() as $level) {
             $this->unloadLevel($level, true);
         }
         $this->katana->console->system("Removing event handlers");
         HandlerList::unregisterAll();
         $this->katana->console->system("Saving properties");
         $this->properties->save();
         $this->katana->console->system("Closing console");
         $this->console->kill();
         $this->katana->console->system("Stopping network interfaces");
         foreach ($this->network->getInterfaces() as $interface) {
             $interface->shutdown();
             $this->network->unregisterInterface($interface);
         }
         $this->memoryManager->doObjectCleanup();
         gc_collect_cycles();
     } catch (\Exception $e) {
         $this->logger->emergency("Crashed while crashing, killing process");
         @kill(getmypid());
     }
 }