当前位置: 首页>>代码示例>>PHP>>正文


PHP Server::getKatana方法代码示例

本文整理汇总了PHP中pocketmine\Server::getKatana方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::getKatana方法的具体用法?PHP Server::getKatana怎么用?PHP Server::getKatana使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\Server的用法示例。


在下文中一共展示了Server::getKatana方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check

 public function check()
 {
     for ($n = 0; $n < $this->threads; ++$n) {
         if ($this->workers[$n]->isTerminated() === true) {
             $this->workers[$n] = new RCONInstance($this->socket, $this->password, $this->clientsPerThread);
         } elseif ($this->workers[$n]->isWaiting()) {
             if ($this->workers[$n]->response !== "") {
                 $this->server->getKatana()->console->system($this->workers[$n]->response);
                 $this->workers[$n]->synchronized(function (RCONInstance $thread) {
                     $thread->notify();
                 }, $this->workers[$n]);
             } else {
                 $response = new RemoteConsoleCommandSender();
                 $command = $this->workers[$n]->cmd;
                 $this->server->getPluginManager()->callEvent($ev = new RemoteServerCommandEvent($response, $command));
                 if (!$ev->isCancelled()) {
                     $this->server->dispatchCommand($ev->getSender(), $ev->getCommand());
                 }
                 $this->workers[$n]->response = TextFormat::clean($response->getMessage());
                 $this->workers[$n]->synchronized(function (RCONInstance $thread) {
                     $thread->notify();
                 }, $this->workers[$n]);
             }
         }
     }
 }
开发者ID:Guillaume351,项目名称:Katana,代码行数:26,代码来源:RCON.php

示例2: disablePlugin

 /**
  * @param Plugin $plugin
  */
 public function disablePlugin(Plugin $plugin)
 {
     if ($plugin instanceof PluginBase and $plugin->isEnabled()) {
         $this->server->getKatana()->console->plugin("Disabling " . Terminal::$COLOR_WHITE . $plugin->getDescription()->getFullName());
         $this->server->getPluginManager()->callEvent(new PluginDisableEvent($plugin));
         $plugin->setEnabled(false);
     }
 }
开发者ID:Guillaume351,项目名称:Katana,代码行数:11,代码来源:PharPluginLoader.php

示例3: define

        //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 Katana installation detected, do not use on production.");
    }
    ThreadManager::init();
    $server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
    $server->getKatana()->console->system("Stopping other threads");
    foreach (ThreadManager::getInstance()->getAll() as $id => $thread) {
        $server->getKatana()->console->system("Stopping " . Terminal::$COLOR_WHITE . (new \ReflectionClass($thread))->getShortName() . Terminal::$COLOR_GRAY . " thread");
        $thread->quit();
    }
    $killer = new ServerKiller(8);
    $killer->start();
    $killer->detach();
    $logger->shutdown();
    $logger->join();
    echo Terminal::$FORMAT_RESET . "\n";
    exit(0);
}
开发者ID:TexusDark,项目名称:Katana,代码行数:31,代码来源:PocketMine.php

示例4: chunkRequestCallback

 public function chunkRequestCallback($x, $z, $payload, $ordering = FullChunkDataPacket::ORDER_COLUMNS)
 {
     $this->timings->syncChunkSendTimer->startTiming();
     $index = Level::chunkHash($x, $z);
     $this->saveChunkToDisk($x, $z, $payload, $ordering);
     if (isset($this->chunkSendTasks[$index])) {
         foreach ($this->chunkSendQueue[$index] as $player) {
             /** @var Player $player */
             if ($player->isConnected() and isset($player->usedChunks[$index])) {
                 $player->sendBatchedChunk($x, $z, $this->chunkCache[$x . ":" . $z]);
             }
         }
         unset($this->chunkSendQueue[$index]);
         unset($this->chunkSendTasks[$index]);
     }
     $this->timings->syncChunkSendTimer->stopTiming();
     if (!$this->server->getKatana()->getProperty("cache.save-to-ram", true)) {
         unset($this->chunkCache[$x . ":" . $z]);
     }
 }
开发者ID:AbelGamerC,项目名称:Katana,代码行数:20,代码来源:Level.php

示例5: saveChunkToDisk

 public function saveChunkToDisk($x, $z, $payload, $ordering = FullChunkDataPacket::ORDER_COLUMNS)
 {
     // When the payload of the chunk has been calculated it, save it if possible to save future CPU cycles
     /** @var Player $player */
     if (file_exists("chunk_cache/" . $this->getName() . "/" . $x . "_" . $z . ".dat")) {
         return $this->loadChunkFromDisk($x, $z);
     }
     $pk = new FullChunkDataPacket();
     $pk->chunkX = $x;
     $pk->chunkZ = $z;
     $pk->order = $ordering;
     $pk->data = $payload;
     $pk->encode();
     // all chunks are zlib_encoded, level is arbitrary but 6 is a good match between device CPU power needed
     // and bandwidth
     $data = zlib_encode(Binary::writeInt(strlen($pk->buffer)) . $pk->buffer, ZLIB_ENCODING_DEFLATE, 6);
     if (!$this->server->getKatana()->getProperty("caching.save-to-disk", true)) {
         return $data;
     }
     file_put_contents("chunk_cache/" . $this->getName() . "/" . $x . "_" . $z . ".dat", $data);
     return $data;
 }
开发者ID:vvzar,项目名称:Katana,代码行数:22,代码来源:Level.php


注:本文中的pocketmine\Server::getKatana方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。