pocketmine\network\rcon\RCON::stop PHP Method

stop() public method

public stop ( )
    public function stop()
    {
        for ($n = 0; $n < $this->threads; ++$n) {
            $this->workers[$n]->close();
            Server::microSleep(50000);
            $this->workers[$n]->close();
            $this->workers[$n]->quit();
        }
        @socket_close($this->socket);
        $this->threads = 0;
    }

Usage Example

Esempio n. 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());
     }
 }
All Usage Examples Of pocketmine\network\rcon\RCON::stop