Inheritance: extends pocketmine\Thread
Example #1
0
 /**
  * Shutdowns the server correctly
  */
 public function shutdown()
 {
     if ($this->isRunning) {
         $killer = new ServerKiller(90);
         $killer->start();
         $killer->detach();
     }
     $this->isRunning = false;
 }
Example #2
0
    if (file_exists(\pocketmine\PATH . ".git/refs/heads/master")) {
        //Found Git information!
        define('pocketmine\\GIT_COMMIT', strtolower(trim(file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
    } else {
        //Unknown :(
        define('pocketmine\\GIT_COMMIT', str_repeat("00", 20));
    }
    @define("ENDIANNESS", pack("d", 1) === "?ð" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN);
    @define("INT32_MASK", is_int(4294967295.0) ? 4294967295.0 : -1);
    @ini_set("opcache.mmap_base", bin2hex(Utils::getRandomBytes(8, false)));
    //Fix OPCache address errors
    if (!file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])) {
        new Installer();
    }
    if (\Phar::running(true) === "") {
        $logger->warning("Non-packaged PocketMine-MP installation detected, do not use on production.");
    }
    ThreadManager::init();
    $server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
    $logger->info("Stopping other threads");
    foreach (ThreadManager::getInstance()->getAll() as $id => $thread) {
        $logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
        $thread->quit();
    }
    $killer = new ServerKiller(8);
    $killer->start();
    $logger->shutdown();
    $logger->join();
    echo Terminal::$FORMAT_RESET . "\n";
    exit(0);
}
        //Found Git information!
        \define("pocketmine\\GIT_COMMIT", \strtolower(\trim(\file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
    } else {
        //Unknown :(
        \define("pocketmine\\GIT_COMMIT", \str_repeat("00", 20));
    }
    @\define("ENDIANNESS", \pack("d", 1) === "?ð" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN);
    @\define("INT32_MASK", \is_int(4294967295.0) ? 4294967295.0 : -1);
    @\ini_set("opcache.mmap_base", \bin2hex(Utils::getRandomBytes(8, \false)));
    //Fix OPCache address errors
    if (!\file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])) {
        new Installer();
    }
    if (\Phar::running(\true) === "") {
        $logger->warning("Non-packaged PocketMine-MP installation detected, do not use on production.");
    }
    ThreadManager::init();
    $server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
    $logger->info("Stopping other threads");
    foreach (ThreadManager::getInstance()->getAll() as $id => $thread) {
        $logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
        $thread->quit();
    }
    $killer = new ServerKiller(8);
    $killer->start();
    $killer->detach();
    $logger->shutdown();
    $logger->join();
    echo Terminal::$FORMAT_RESET . "\n";
    exit(0);
}
Example #4
0
 /**
  * Shutdowns the server correctly
  */
 public function shutdown()
 {
     /*if($this->expEnabled){
     			foreach($this->getLevels() as $level){
     				foreach($level->getEntities() as $e){
     					if($e instanceof ExperienceOrb) $e->close();
     				}
     			}
     		}*/
     if ($this->isRunning) {
         $killer = new ServerKiller(90);
         $killer->start();
         $killer->detach();
     }
     $this->isRunning = false;
 }