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


PHP Server::getVersion方法代码示例

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


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

示例1: __construct

 public function __construct(Server $server, $timeout = 5)
 {
     $this->timeout = $timeout;
     $this->serverName = $server->getMotd();
     $this->listPlugins = $server->getProperty("settings.query-plugins", true);
     $this->plugins = $server->getPluginManager()->getPlugins();
     $this->players = [];
     foreach ($server->getOnlinePlayers() as $player) {
         if ($player->isOnline()) {
             $this->players[] = $player;
         }
     }
     if ($server->isDServerEnabled() and $server->dserverConfig["queryMaxPlayers"]) {
         $pc = $server->dserverConfig["queryMaxPlayers"];
     } elseif ($server->isDServerEnabled() and $server->dserverConfig["queryAllPlayers"]) {
         $pc = $server->getDServerMaxPlayers();
     } else {
         $pc = $server->getMaxPlayers();
     }
     if ($server->isDServerEnabled() and $server->dserverConfig["queryPlayers"]) {
         $poc = $server->getDServerOnlinePlayers();
     } else {
         $poc = count($this->players);
     }
     $this->gametype = ($server->getGamemode() & 0x1) === 0 ? "SMP" : "CMP";
     $this->version = $server->getVersion();
     $this->server_engine = $server->getName() . " " . $server->getPocketMineVersion();
     $this->map = $server->getDefaultLevel() === null ? "unknown" : $server->getDefaultLevel()->getName();
     $this->numPlayers = $poc;
     $this->maxPlayers = $pc;
     $this->whitelist = $server->hasWhitelist() ? "on" : "off";
     $this->port = $server->getPort();
     $this->ip = $server->getIp();
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:34,代码来源:QueryRegenerateEvent.php

示例2: __construct

 public function __construct($server)
 {
     $this->server = $server;
     $this->logger = $this->server->getLogger();
     $this->logger->info(Terminal::$COLOR_GOLD . "-------------------------------------------------------------------------------------------");
     $this->logger->info(Terminal::$COLOR_GOLD . "|" . Terminal::$COLOR_PURPLE . "  _                       _           _" . Terminal::$COLOR_AQUA . " __  __ _ " . Terminal::$COLOR_GOLD . "                                        |");
     $this->logger->info(Terminal::$COLOR_GOLD . "|" . Terminal::$COLOR_PURPLE . " (_)                     (_)         | |" . Terminal::$COLOR_AQUA . "  \\/  (_) " . Terminal::$COLOR_GOLD . "                                       |");
     $this->logger->info(Terminal::$COLOR_GOLD . "|" . Terminal::$COLOR_PURPLE . "  _ _ __ ___   __ _  __ _ _  ___ __ _| |" . Terminal::$COLOR_AQUA . " \\  / |_ _ __   ___ " . Terminal::$COLOR_GOLD . "                             |");
     $this->logger->info(Terminal::$COLOR_GOLD . "|" . Terminal::$COLOR_PURPLE . " | | '_ ` _ \\ / _` |/ _` | |/ __/ _` | |" . Terminal::$COLOR_AQUA . " |\\/| | | '_ \\ / _ \\ " . Terminal::$COLOR_RED . "     ImagicalMine " . $this->server->getPocketMineVersion() . Terminal::$COLOR_GOLD . "       |");
     $this->logger->info(Terminal::$COLOR_GOLD . "|" . Terminal::$COLOR_PURPLE . " | | | | | | | (_| | (_| | | (_| (_| | |" . Terminal::$COLOR_AQUA . " |  | | | | | |  __/ " . Terminal::$COLOR_GOLD . "                            |");
     $this->logger->info(Terminal::$COLOR_GOLD . "|" . Terminal::$COLOR_PURPLE . " |_|_| |_| |_|\\__,_|\\__, |_|\\___\\__,_|_|" . Terminal::$COLOR_AQUA . "_|  |_|_|_| |_|\\___| " . Terminal::$COLOR_WHITE . "   for MCPE " . $this->server->getVersion() . Terminal::$COLOR_GOLD . "   |");
     $this->logger->info(Terminal::$COLOR_GOLD . "|" . Terminal::$COLOR_PURPLE . "                     __/ |" . Terminal::$COLOR_GOLD . "                                                               |");
     $this->logger->info(Terminal::$COLOR_GOLD . "|" . Terminal::$COLOR_PURPLE . "                    |___/" . Terminal::$COLOR_GOLD . "                                                                |");
     $this->logger->info(Terminal::$COLOR_GOLD . "------------------------------------------------------------------------------------------- ");
     $this->logger->info(Terminal::$COLOR_PURPLE . "Imagical" . Terminal::$COLOR_AQUA . "Mine " . Terminal::$COLOR_WHITE . "is a third-party build of " . Terminal::$COLOR_AQUA . "PocketMine-MP" . Terminal::$COLOR_WHITE . ", distributed under the LGPL licence");
 }
开发者ID:Cecil107,项目名称:PocketMine-0.13.0,代码行数:16,代码来源:Katana.php

示例3: __construct

 public function __construct($server)
 {
     $this->server = $server;
     $this->getServer()->getLogger()->info(Terminal::$COLOR_GOLD . " ");
     $this->getServer()->getLogger()->info(Terminal::$COLOR_BLUE . ",_._._._._._._._._" . Terminal::$COLOR_DARK_BLUE . "|" . Terminal::$COLOR_GRAY . "_________________________________________________,");
     $this->getServer()->getLogger()->info(Terminal::$COLOR_BLUE . "|_|_|_|_|_|_|_|_|_" . Terminal::$COLOR_DARK_BLUE . "|" . Terminal::$COLOR_GRAY . "________________________________________________/");
     $this->getServer()->getLogger()->info(Terminal::$COLOR_GOLD . "     _           " . Terminal::$COLOR_DARK_BLUE . " l");
     $this->getServer()->getLogger()->info(Terminal::$COLOR_GOLD . "    | | ____ _| |_ __ _ _ __   __ _");
     $this->getServer()->getLogger()->info(Terminal::$COLOR_GOLD . "    | |/ / _` | __/ _` | '_ \\ / _` |    " . Terminal::$COLOR_AQUA . "MCPE " . $this->server->getVersion());
     $this->getServer()->getLogger()->info(Terminal::$COLOR_GOLD . "    |   < (_| | || (_| | | | | (_| |    " . Terminal::$COLOR_AQUA . "Katana " . $this->server->getPocketMineVersion());
     $this->getServer()->getLogger()->info(Terminal::$COLOR_GOLD . "    |_|\\_\\__,_|\\__\\__,_|_| |_|\\__,_|");
     $this->getServer()->getLogger()->info(Terminal::$COLOR_GOLD . " ");
     $this->getServer()->getLogger()->info(Terminal::$COLOR_GOLD . "Katana " . Terminal::$COLOR_WHITE . "is a fork of " . Terminal::$COLOR_AQUA . "PocketMine-MP" . Terminal::$COLOR_WHITE . ", distributed under the LGPL licence");
     $this->initConfig();
     $this->initLogger();
     $this->initModules();
 }
开发者ID:TexusDark,项目名称:Katana,代码行数:17,代码来源:Katana.php

示例4: __construct

 public function __construct(Server $server, $timeout = 5)
 {
     $this->timeout = $timeout;
     $this->serverName = $server->getMotd();
     $this->listPlugins = $server->getProperty("settings.query-plugins", true);
     $this->plugins = str_replace(" ", "_", $server->getPluginManager()->getPlugins());
     $this->players = [];
     foreach ($server->getOnlinePlayers() as $player) {
         if ($player->isOnline()) {
             $this->players[] = $player;
         }
     }
     if ($server->isDServerEnabled() and $server->dserverConfig["queryMaxPlayers"]) {
         $pc = $server->dserverConfig["queryMaxPlayers"];
     } elseif ($server->isDServerEnabled() and $server->dserverConfig["queryAllPlayers"]) {
         $pc = $server->getDServerMaxPlayers();
     } else {
         $pc = $server->getMaxPlayers();
     }
     if ($server->isDServerEnabled() and $server->dserverConfig["queryPlayers"]) {
         $poc = $server->getDServerOnlinePlayers();
     } else {
         $poc = count($this->players);
     }
     switch ($server->getGamemode()) {
         case 0:
             $this->gametype = "Survival";
             break;
         case 1:
             $this->gametype = "Creative";
             break;
         case 2:
             $this->gametype = "Adventure";
             break;
         case 3:
             $this->gametype = "Spectator";
             break;
     }
     $this->version = $server->getVersion();
     $this->server_engine = $server->getName() . " " . $server->getPocketMineVersion();
     $this->map = $server->getDefaultLevel() === null ? "unknown" : $server->getDefaultLevel()->getName();
     $this->numPlayers = $poc;
     $this->maxPlayers = $pc;
     $this->whitelist = $server->hasWhitelist() ? "on" : "off";
     $this->port = $server->getPort();
     $this->ip = $server->getIp();
     $this->motd_version = $server->getMPVersion();
 }
开发者ID:AnonymousProjects,项目名称:PocketMine-MP-Original,代码行数:48,代码来源:QueryRegenerateEvent.php

示例5: __construct

 public function __construct(Server $server, $type, $playerList = [])
 {
     $endpoint = "http://" . $server->getProperty("anonymous-statistics.host", "stats.pocketmine.net") . "/";
     $data = [];
     $data["uniqueServerId"] = $server->getServerUniqueId()->toString();
     $data["uniqueMachineId"] = Utils::getMachineUniqueId()->toString();
     $data["uniqueRequestId"] = UUID::fromData($server->getServerUniqueId(), microtime(true))->toString();
     switch ($type) {
         case self::TYPE_OPEN:
             $data["event"] = "open";
             $version = new VersionString();
             $data["server"] = ["port" => $server->getPort(), "software" => $server->getName(), "fullVersion" => $version->get(true), "version" => $version->get(), "build" => $version->getBuild(), "api" => $server->getApiVersion(), "minecraftVersion" => $server->getVersion(), "protocol" => Info::CURRENT_PROTOCOL];
             $data["system"] = ["operatingSystem" => Utils::getOS(), "cores" => Utils::getCoreCount(), "phpVersion" => PHP_VERSION, "machine" => php_uname("a"), "release" => php_uname("r"), "platform" => php_uname("i")];
             $data["players"] = ["count" => 0, "limit" => $server->getMaxPlayers()];
             $plugins = [];
             foreach ($server->getPluginManager()->getPlugins() as $p) {
                 $d = $p->getDescription();
                 $plugins[$d->getName()] = ["name" => $d->getName(), "version" => $d->getVersion(), "enabled" => $p->isEnabled()];
             }
             $data["plugins"] = $plugins;
             break;
         case self::TYPE_STATUS:
             $data["event"] = "status";
             $data["server"] = ["ticksPerSecond" => $server->getTicksPerSecondAverage(), "tickUsage" => $server->getTickUsageAverage(), "ticks" => $server->getTick()];
             //This anonymizes the user ids so they cannot be reversed to the original
             foreach ($playerList as $k => $v) {
                 $playerList[$k] = md5($v);
             }
             $players = [];
             foreach ($server->getOnlinePlayers() as $p) {
                 if ($p->isOnline()) {
                     $players[] = md5($p->getUniqueId()->toBinary());
                 }
             }
             $data["players"] = ["count" => count($players), "limit" => $server->getMaxPlayers(), "currentList" => $players, "historyList" => array_values($playerList)];
             $info = Utils::getMemoryUsage(true);
             $data["system"] = ["mainMemory" => $info[0], "totalMemory" => $info[1], "availableMemory" => $info[2], "threadCount" => Utils::getThreadCount()];
             break;
         case self::TYPE_CLOSE:
             $data["event"] = "close";
             $data["crashing"] = $server->isRunning();
             break;
     }
     $this->endpoint = $endpoint . "api/post";
     $this->data = json_encode($data);
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:46,代码来源:SendUsageTask.php

示例6: __construct

 public function __construct(Server $server, $timeout = 5)
 {
     $this->timeout = $timeout;
     $this->serverName = $server->getServerName();
     $this->listPlugins = $server->getProperty("settings.query-plugins", \true);
     $this->plugins = $server->getPluginManager()->getPlugins();
     $this->players = [];
     foreach ($server->getOnlinePlayers() as $player) {
         if ($player->isOnline()) {
             $this->players[] = $player;
         }
     }
     $this->gametype = ($server->getGamemode() & 0x1) === 0 ? "SMP" : "CMP";
     $this->version = $server->getVersion();
     $this->server_engine = $server->getName() . " " . $server->getPocketMineVersion();
     $this->map = $server->getDefaultLevel() === \null ? "unknown" : $server->getDefaultLevel()->getName();
     $this->numPlayers = \count($this->players);
     $this->maxPlayers = $server->getMaxPlayers();
     $this->whitelist = $server->hasWhitelist() ? "on" : "off";
     $this->port = $server->getPort();
     $this->ip = $server->getIp();
 }
开发者ID:xpyctum,项目名称:PocketMinePlusPlus,代码行数:22,代码来源:QueryRegenerateEvent.php

示例7: sendServerInfo

 /**
  * @param CommandSender $sender
  * @param Server $server
  */
 public function sendServerInfo(CommandSender $sender, Server $server)
 {
     $sender->sendMessage("Name: " . $server->getServerName());
     $sender->sendMessage("Motd: " . $server->getMotd());
     $sender->sendMessage("Network-motd: " . $server->getNetwork()->getMotd());
     $sender->sendMessage("Address: " . $server->getIp() . ":" . $server->getPort());
     $sender->sendMessage("Players: " . count($server->getOnlinePlayers()) . "/" . $server->getMaxPlayers());
     $sender->sendMessage("Difficulty: " . $server->getDifficulty());
     $sender->sendMessage("Default-gamemode: " . $server->getDefaultGamemode());
     $sender->sendMessage("Unique-id: " . $server->getServerUniqueId());
     $sender->sendMessage("TPS: " . $server->getTicksPerSecond());
     $sender->sendMessage("Average-TPS: " . $server->getTicksPerSecondAverage());
     $sender->sendMessage("Codename: " . $server->getCodename());
     $sender->sendMessage("API-version: " . $server->getApiVersion());
     $sender->sendMessage("MCPE-version: " . $server->getVersion());
     $sender->sendMessage("Is-hardcore: " . ($server->isHardcore() ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $sender->sendMessage("Is-running: " . ($server->isRunning() ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $sender->sendMessage("Is-whitelisted: " . ($server->hasWhitelist() ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
 }
开发者ID:happyexceed,项目名称:PocketMine-Plugins-1,代码行数:23,代码来源:InfoFetcher.php


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