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


PHP Server::getLevels方法代码示例

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


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

示例1: generalData

 private function generalData()
 {
     $version = new VersionString();
     $this->data["general"] = [];
     $this->data["general"]["version"] = $version->get(false);
     $this->data["general"]["build"] = $version->getBuild();
     $this->data["general"]["protocol"] = Info::CURRENT_PROTOCOL;
     $this->data["general"]["api"] = \pocketmine\API_VERSION;
     $this->data["general"]["git"] = \pocketmine\GIT_COMMIT;
     $this->data["general"]["raklib"] = RakLib::VERSION;
     $this->data["general"]["uname"] = php_uname("a");
     $this->data["general"]["php"] = phpversion();
     $this->data["general"]["zend"] = zend_version();
     $this->data["general"]["php_os"] = PHP_OS;
     $this->data["general"]["os"] = Utils::getOS();
     $this->addLine("Genisys version: " . $version->get(false) . " #" . $version->getBuild() . " [Protocol " . Info::CURRENT_PROTOCOL . "; API " . API_VERSION . "]");
     $this->addLine("uname -a: " . php_uname("a"));
     $this->addLine("PHP version: " . phpversion());
     $this->addLine("Zend version: " . zend_version());
     $this->addLine("OS : " . PHP_OS . ", " . Utils::getOS());
     $this->addLine();
     $this->addLine("Server uptime: " . $this->server->getUptime());
     $this->addLine("Number of loaded worlds: " . count($this->server->getLevels()));
     $this->addLine("Players online: " . count($this->server->getOnlinePlayers()) . "/" . $this->server->getMaxPlayers());
 }
开发者ID:AnonymousProjects,项目名称:PocketMine-MP-Original,代码行数:25,代码来源:CrashDump.php

示例2: select

 public static function select(Server $srv, CommandSender $sender, array $args)
 {
     $result = [];
     if (!isset($args["type"])) {
         $args["type"] = "player";
     }
     foreach ($srv->getLevels() as $l) {
         foreach ($l->getEntities() as $e) {
             if (count($args) && !$owner->checkSelectors($args, $sender, $e)) {
                 continue;
             }
             if ($e instanceof Player) {
                 $result[] = $e->getName();
             } else {
                 $result[] = "e" . $e->getId();
             }
         }
     }
     if (!isset($args["c"])) {
         $args["c"] = 1;
     }
     $c = [];
     $n = intval($args["c"]);
     while ($n-- > 0 && count($result)) {
         $i = array_rand($result);
         $c[] = $result[$i];
         unset($result[$i]);
     }
     return $c;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:30,代码来源:Random.php

示例3: triggerGarbageCollector

 public function triggerGarbageCollector()
 {
     Timings::$garbageCollectorTimer->startTiming();
     if ($this->garbageCollectionAsync) {
         $size = $this->server->getScheduler()->getAsyncTaskPoolSize();
         for ($i = 0; $i < $size; ++$i) {
             $this->server->getScheduler()->scheduleAsyncTaskToWorker(new GarbageCollectionTask(), $i);
         }
     }
     $cycles = gc_collect_cycles();
     foreach ($this->server->getLevels() as $level) {
         $level->doChunkGarbageCollection();
     }
     Timings::$garbageCollectorTimer->stopTiming();
     return $cycles;
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:16,代码来源:MemoryManager.php

示例4: select

 public static function select(Server $srv, CommandSender $sender, array $args)
 {
     $result = [];
     foreach ($srv->getLevels() as $l) {
         foreach ($l->getEntities() as $e) {
             if (count($args) && !$owner->checkSelectors($args, $sender, $e)) {
                 continue;
             }
             if ($e instanceof Player) {
                 $result[] = $e->getName();
             } else {
                 $result[] = "e" . $e->getId();
             }
         }
     }
     return $result;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:17,代码来源:AllEntity.php

示例5: trigger

 public function trigger($memory, $limit, $global = false, $triggerCount = 0)
 {
     $this->server->getLogger()->debug("[Memory Manager] " . ($global ? "Global " : "") . "Low memory triggered, limit " . round($limit / 1024 / 1024, 2) . "MB, using " . round($memory / 1024 / 1024, 2) . "MB");
     if ($this->cacheTrigger) {
         foreach ($this->server->getLevels() as $level) {
             $level->clearCache(true);
         }
     }
     if ($this->chunkTrigger and $this->chunkCollect) {
         foreach ($this->server->getLevels() as $level) {
             $level->doChunkGarbageCollection();
         }
     }
     $ev = new LowMemoryEvent($memory, $limit, $global, $triggerCount);
     $this->server->getPluginManager()->callEvent($ev);
     $cycles = 0;
     if ($this->garbageCollectionTrigger) {
         $cycles = $this->triggerGarbageCollector();
     }
     $this->server->getLogger()->debug("[Memory Manager] Freed " . round($ev->getMemoryFreed() / 1024 / 1024, 2) . "MB, {$cycles} cycles");
 }
开发者ID:ianju,项目名称:PocketMine-MP,代码行数:21,代码来源:MemoryManager.php


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