Exemple #1
0
 public static function getThreadCount()
 {
     if (Utils::getOS() === "linux" or Utils::getOS() === "android") {
         if (preg_match("/Threads:[ \t]+([0-9]+)/", file_get_contents("/proc/self/status"), $matches) > 0) {
             return (int) $matches[1];
         }
     }
     //TODO: more OS
     return count(ThreadManager::getInstance()->getAll()) + 3;
     //RakLib + MainLogger + Main Thread
 }
Exemple #2
0
    @define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1);
    @ini_set("opcache.mmap_base", bin2hex(Utils::getRandomBytes(8, false)));
    //Fix OPCache address errors
    if (!file_exists(\BukkitPE\DATA . "server.properties") and !isset($opts["no-wizard"])) {
        new Installer();
    }
    if (\Phar::running(true) === "") {
        $logger->info("§c{--------------------====================--------------------}");
        $logger->info("§6BukkitPE - MCPE Server Software");
        $logger->info("§9- §eYou may use on production");
        $logger->info("§9- §ePlugins: Forums.BukkitPE.net/plugins (Being work on)");
        $logger->info("§9- §eSite: BukkitPE.net (Being work on)");
        $logger->info("§9- §eBugs?: https://github.com/BukkitPE/BukkitPE/issues");
        $logger->info("§9- §3BukkitPE was made by: AndreTheGamer , DelxHQ");
        $logger->info("§c{---------------------====================--------------------}");
    }
    ThreadManager::init();
    $server = new Server($autoloader, $logger, \BukkitPE\PATH, \BukkitPE\DATA, \BukkitPE\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);
}