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


PHP Server::getProperty方法代码示例

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


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

示例1: __construct

 public function __construct(Server $server)
 {
     $this->server = $server;
     $this->timeout = $server->getProperty("network.timeout", -1);
     $this->currentprotocol = $server->getProperty("network.protocol", 39);
     $this->networkversion = $server->getProperty("network.version", "0.13.2");
     $this->identifiers = [];
     $this->rakLib = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp());
     $this->interface = new ServerHandler($this->rakLib, $this);
     for ($i = 0; $i < 256; ++$i) {
         $this->channelCounts[$i] = 0;
     }
 }
开发者ID:kakichi,项目名称:ClearSky,代码行数:13,代码来源:RakLibInterface.php

示例2: __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

示例3: getChannel

 public function getChannel()
 {
     $channel = strtolower($this->server->getProperty("auto-updater.preferred-channel", "stable"));
     if ($channel !== "stable" and $channel !== "beta" and $channel !== "development") {
         $channel = "stable";
     }
     return $channel;
 }
开发者ID:1455931078,项目名称:Genisys,代码行数:8,代码来源:AutoUpdater.php

示例4: getChannel

 public function getChannel()
 {
     $channel = strtolower($this->server->getProperty("auto-updater.preferred-channel", "ClearSky"));
     if ($channel !== "ClearSky" and $channel !== "ClearSky-php7") {
         $channel = "ClearSky";
     }
     return $channel;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:8,代码来源:AutoUpdater.php

示例5: init

 private function init()
 {
     $this->memoryLimit = (int) $this->server->getProperty("memory.main-limit", 0) * 1024 * 1024;
     $defaultMemory = 1024;
     if (preg_match("/([0-9]+)([KMGkmg])/", $this->server->getConfigString("memory-limit", ""), $matches) > 0) {
         $m = (int) $matches[1];
         if ($m <= 0) {
             $defaultMemory = 0;
         } else {
             switch (strtoupper($matches[2])) {
                 case "K":
                     $defaultMemory = $m / 1024;
                     break;
                 case "M":
                     $defaultMemory = $m;
                     break;
                 case "G":
                     $defaultMemory = $m * 1024;
                     break;
                 default:
                     $defaultMemory = $m;
                     break;
             }
         }
     }
     $hardLimit = (int) $this->server->getProperty("memory.main-hard-limit", $defaultMemory);
     if ($hardLimit <= 0) {
         ini_set("memory_limit", -1);
     } else {
         ini_set("memory_limit", $hardLimit . "M");
     }
     $this->globalMemoryLimit = (int) $this->server->getProperty("memory.global-limit", 0) * 1024 * 1024;
     $this->checkRate = (int) $this->server->getProperty("memory.check-rate", 20);
     $this->continuousTrigger = (bool) $this->server->getProperty("memory.continuous-trigger", true);
     $this->continuousTriggerRate = (int) $this->server->getProperty("memory.continuous-trigger-rate", 30);
     $this->garbageCollectionPeriod = (int) $this->server->getProperty("memory.garbage-collection.period", 36000);
     $this->garbageCollectionTrigger = (bool) $this->server->getProperty("memory.garbage-collection.low-memory-trigger", true);
     $this->garbageCollectionAsync = (bool) $this->server->getProperty("memory.garbage-collection.collect-async-worker", true);
     $this->chunkLimit = (int) $this->server->getProperty("memory.max-chunks.trigger-limit", 96);
     $this->chunkCollect = (bool) $this->server->getProperty("memory.max-chunks.trigger-chunk-collect", true);
     $this->chunkTrigger = (bool) $this->server->getProperty("memory.max-chunks.low-memory-trigger", true);
     $this->chunkCache = (bool) $this->server->getProperty("memory.world-caches.disable-chunk-cache", true);
     $this->cacheTrigger = (bool) $this->server->getProperty("memory.world-caches.low-memory-trigger", true);
     gc_enable();
 }
开发者ID:ianju,项目名称:PocketMine-MP,代码行数:45,代码来源:MemoryManager.php

示例6: setDefaultCommands

 private function setDefaultCommands()
 {
     $this->register("pocketmine", new WeatherCommand("weather"));
     $this->register("pocketmine", new BanCidCommand("bancid"));
     $this->register("pocketmine", new PardonCidCommand("pardoncid"));
     $this->register("pocketmine", new BancidbynameCommand("bancidbyname"));
     $this->register("pocketmine", new BanipbynameCommand("banipbyname"));
     $this->register("pocketmine", new ExtractPharCommand("extractphar"));
     $this->register("pocketmine", new ExtractPluginCommand("extractplugin"));
     $this->register("pocketmine", new MakePluginCommand("makeplugin"));
     $this->register("pocketmine", new MakeServerCommand("ms"));
     //$this->register("pocketmine", new MakeServerCommand("makeserver"));
     $this->register("pocketmine", new LoadPluginCommand("loadplugin"));
     $this->register("pocketmine", new LvdatCommand("lvdat"));
     $this->register("pocketmine", new BiomeCommand("biome"));
     $this->register("pocketmine", new VersionCommand("version"));
     $this->register("pocketmine", new PluginsCommand("plugins"));
     $this->register("pocketmine", new SeedCommand("seed"));
     $this->register("pocketmine", new HelpCommand("help"));
     $this->register("pocketmine", new StopCommand("stop"));
     $this->register("pocketmine", new TellCommand("tell"));
     $this->register("pocketmine", new DefaultGamemodeCommand("defaultgamemode"));
     $this->register("pocketmine", new BanCommand("ban"));
     $this->register("pocketmine", new BanIpCommand("ban-ip"));
     $this->register("pocketmine", new BanListCommand("banlist"));
     $this->register("pocketmine", new PardonCommand("pardon"));
     $this->register("pocketmine", new PardonIpCommand("pardon-ip"));
     $this->register("pocketmine", new SayCommand("say"));
     $this->register("pocketmine", new MeCommand("me"));
     $this->register("pocketmine", new ListCommand("list"));
     $this->register("pocketmine", new DifficultyCommand("difficulty"));
     $this->register("pocketmine", new KickCommand("kick"));
     $this->register("pocketmine", new OpCommand("op"));
     $this->register("pocketmine", new DeopCommand("deop"));
     $this->register("pocketmine", new WhitelistCommand("whitelist"));
     $this->register("pocketmine", new SaveOnCommand("save-on"));
     $this->register("pocketmine", new SaveOffCommand("save-off"));
     $this->register("pocketmine", new SaveCommand("save-all"));
     $this->register("pocketmine", new GiveCommand("give"));
     $this->register("pocketmine", new EffectCommand("effect"));
     $this->register("pocketmine", new EnchantCommand("enchant"));
     $this->register("pocketmine", new ParticleCommand("particle"));
     $this->register("pocketmine", new GamemodeCommand("gamemode"));
     $this->register("pocketmine", new KillCommand("kill"));
     $this->register("pocketmine", new SpawnpointCommand("spawnpoint"));
     $this->register("pocketmine", new SetWorldSpawnCommand("setworldspawn"));
     $this->register("pocketmine", new TeleportCommand("tp"));
     $this->register("pocketmine", new TimeCommand("time"));
     $this->register("pocketmine", new TimingsCommand("timings"));
     $this->register("pocketmine", new ReloadCommand("reload"));
     $this->register("pocketmine", new XpCommand("xp"));
     if ($this->server->getProperty("debug.commands", false)) {
         $this->register("pocketmine", new StatusCommand("status"));
         $this->register("pocketmine", new GarbageCollectorCommand("gc"));
         $this->register("pocketmine", new DumpMemoryCommand("dumpmemory"));
     }
 }
开发者ID:DelxHQ,项目名称:Genisys,代码行数:57,代码来源:SimpleCommandMap.php

示例7: __construct

 public function __construct(Server $server, $endpoint)
 {
     $this->server = $server;
     $this->endpoint = "http://{$endpoint}/api/";
     if ($server->getProperty("auto-updater.enabled", true)) {
         $this->check();
         if ($this->hasUpdate()) {
             if ($this->server->getProperty("auto-updater.on-update.warn-console", true)) {
                 $this->showConsoleUpdate();
             }
         }
     }
 }
开发者ID:Hydreon,项目名称:PMSoft238,代码行数:13,代码来源:AutoUpdater.php

示例8: __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

示例9: __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

示例10: setDefaultCommands

 private function setDefaultCommands()
 {
     $this->register("pocketmine", new VersionCommand("version"));
     $this->register("pocketmine", new PluginsCommand("plugins"));
     $this->register("pocketmine", new SeedCommand("seed"));
     $this->register("pocketmine", new HelpCommand("help"));
     $this->register("pocketmine", new StopCommand("stop"));
     $this->register("pocketmine", new TellCommand("tell"));
     $this->register("pocketmine", new DefaultGamemodeCommand("defaultgamemode"));
     $this->register("pocketmine", new BanCommand("ban"));
     $this->register("pocketmine", new BanIpCommand("ban-ip"));
     $this->register("pocketmine", new BanListCommand("banlist"));
     $this->register("pocketmine", new PardonCommand("pardon"));
     $this->register("pocketmine", new PardonIpCommand("pardon-ip"));
     $this->register("pocketmine", new SayCommand("say"));
     $this->register("pocketmine", new MeCommand("me"));
     $this->register("pocketmine", new ListCommand("list"));
     $this->register("pocketmine", new DifficultyCommand("difficulty"));
     $this->register("pocketmine", new KickCommand("kick"));
     $this->register("pocketmine", new OpCommand("op"));
     $this->register("pocketmine", new DeopCommand("deop"));
     $this->register("pocketmine", new WhitelistCommand("whitelist"));
     $this->register("pocketmine", new SaveOnCommand("save-on"));
     $this->register("pocketmine", new SaveOffCommand("save-off"));
     $this->register("pocketmine", new SaveCommand("save-all"));
     $this->register("pocketmine", new GiveCommand("give"));
     $this->register("pocketmine", new EffectCommand("effect"));
     $this->register("pocketmine", new ParticleCommand("particle"));
     $this->register("pocketmine", new GamemodeCommand("gamemode"));
     $this->register("pocketmine", new KillCommand("kill"));
     $this->register("pocketmine", new SpawnpointCommand("spawnpoint"));
     $this->register("pocketmine", new SetWorldSpawnCommand("setworldspawn"));
     $this->register("pocketmine", new TeleportCommand("tp"));
     $this->register("pocketmine", new TimeCommand("time"));
     $this->register("pocketmine", new TimingsCommand("timings"));
     $this->register("pocketmine", new ReloadCommand("reload"));
     if ($this->server->getProperty("debug.commands", false) === true) {
         $this->register("pocketmine", new StatusCommand("status"));
     }
 }
开发者ID:TylerGames,项目名称:PocketMine-MP,代码行数:40,代码来源:SimpleCommandMap.php

示例11: __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

示例12: registerEvents

 /**
  * Registers all the events in the given Listener class
  *
  * @param Listener $listener
  * @param Plugin   $plugin
  *
  * @throws PluginException
  */
 public function registerEvents(Listener $listener, Plugin $plugin)
 {
     if (!$plugin->isEnabled()) {
         throw new PluginException("Plugin attempted to register " . \get_class($listener) . " while not enabled");
     }
     $reflection = new \ReflectionClass(\get_class($listener));
     foreach ($reflection->getMethods() as $method) {
         if (!$method->isStatic()) {
             $priority = EventPriority::NORMAL;
             $ignoreCancelled = \false;
             if (\preg_match("/^[\t ]*\\* @priority[\t ]{1,}([a-zA-Z]{1,})/m", (string) $method->getDocComment(), $matches) > 0) {
                 $matches[1] = \strtoupper($matches[1]);
                 if (\defined(EventPriority::class . "::" . $matches[1])) {
                     $priority = \constant(EventPriority::class . "::" . $matches[1]);
                 }
             }
             if (\preg_match("/^[\t ]*\\* @ignoreCancelled[\t ]{1,}([a-zA-Z]{1,})/m", (string) $method->getDocComment(), $matches) > 0) {
                 $matches[1] = \strtolower($matches[1]);
                 if ($matches[1] === "false") {
                     $ignoreCancelled = \false;
                 } elseif ($matches[1] === "true") {
                     $ignoreCancelled = \true;
                 }
             }
             $parameters = $method->getParameters();
             if (\count($parameters) === 1 and $parameters[0]->getClass() instanceof \ReflectionClass and \is_subclass_of($parameters[0]->getClass()->getName(), Event::class)) {
                 $class = $parameters[0]->getClass()->getName();
                 $reflection = new \ReflectionClass($class);
                 if (\strpos((string) $reflection->getDocComment(), "@deprecated") !== \false and $this->server->getProperty("settings.deprecated-verbose", \true)) {
                     $this->server->getLogger()->warning('Plugin ' . $plugin->getName() . ' has registered a listener for ' . $class . ' on method ' . \get_class($listener) . '->' . $method->getName() . '(), but the event is Deprecated.');
                 }
                 $this->registerEvent($class, $listener, $priority, new MethodEventExecutor($method->getName()), $plugin, $ignoreCancelled);
             }
         }
     }
 }
开发者ID:Edwardthedog2,项目名称:Steadfast2,代码行数:44,代码来源:PluginManager.php

示例13: registerEvents

 /**
  * Registers all the events in the given Listener class
  *
  * @param Listener $listener
  * @param Plugin   $plugin
  *
  * @throws \Exception
  */
 public function registerEvents(Listener $listener, Plugin $plugin)
 {
     if (!$plugin->isEnabled()) {
         throw new \Exception("Plugin attempted to register " . get_class($listener) . " while not enabled");
     }
     $reflection = new \ReflectionClass(get_class($listener));
     foreach ($reflection->getMethods() as $method) {
         if (!$method->isStatic()) {
             $priority = EventPriority::NORMAL;
             $ignoreCancelled = false;
             if (preg_match("/^[\t ]*\\* @priority[\t ]{1,}([a-zA-Z]{1,})\$/m", (string) $method->getDocComment(), $matches) > 0) {
                 $matches[1] = strtoupper($matches[1]);
                 if (defined("pocketmine\\event\\EventPriority::" . $matches[1])) {
                     $priority = constant("pocketmine\\event\\EventPriority::" . $matches[1]);
                 }
             }
             if (preg_match("/^[\t ]*\\* @ignoreCancelled[\t ]{1,}([a-zA-Z]{1,})\$/m", (string) $method->getDocComment(), $matches) > 0) {
                 $matches[1] = strtolower($matches[1]);
                 if ($matches[1] === "false") {
                     $ignoreCancelled = false;
                 } elseif ($matches[1] === "true") {
                     $ignoreCancelled = true;
                 }
             }
             $parameters = $method->getParameters();
             if (count($parameters) === 1 and $parameters[0]->getClass() instanceof \ReflectionClass and is_subclass_of($parameters[0]->getClass()->getName(), "pocketmine\\event\\Event")) {
                 $class = $parameters[0]->getClass()->getName();
                 $reflection = new \ReflectionClass($class);
                 if (preg_match("/^[\t ]*\\* @deprecated[\t ]{1,}\$/m", (string) $reflection->getDocComment(), $matches) > 0 and $this->server->getProperty("settings.deprecated-verbose", true)) {
                     $this->server->getLogger()->warning('"' . $plugin->getName() . '" has registered a listener for ' . $class . ' on method "' . get_class($listener) . '::' . $method . ', but the event is Deprecated.');
                 }
                 $this->registerEvent($class, $listener, $priority, new MethodEventExecutor($method->getName()), $plugin, $ignoreCancelled);
             }
         }
     }
 }
开发者ID:boybook,项目名称:PocketMine-MP,代码行数:44,代码来源:PluginManager.php

示例14: registerEvents

 /**
  * Registers all the events in the given Listener class
  *
  * @param Listener $listener
  * @param Plugin   $plugin
  *
  * @throws PluginException
  */
 public function registerEvents(Listener $listener, Plugin $plugin)
 {
     if (!$plugin->isEnabled()) {
         throw new PluginException("Plugin attempted to register " . get_class($listener) . " while not enabled");
     }
     $reflection = new \ReflectionClass(get_class($listener));
     foreach ($reflection->getMethods() as $method) {
         if (!$method->isStatic()) {
             $priority = EventPriority::NORMAL;
             $ignoreCancelled = false;
             if (preg_match("/^[\t ]*\\* @priority[\t ]{1,}([a-zA-Z]{1,})/m", (string) $method->getDocComment(), $matches) > 0) {
                 $matches[1] = strtoupper($matches[1]);
                 if (defined(EventPriority::class . "::" . $matches[1])) {
                     $priority = constant(EventPriority::class . "::" . $matches[1]);
                 }
             }
             if (preg_match("/^[\t ]*\\* @ignoreCancelled[\t ]{1,}([a-zA-Z]{1,})/m", (string) $method->getDocComment(), $matches) > 0) {
                 $matches[1] = strtolower($matches[1]);
                 if ($matches[1] === "false") {
                     $ignoreCancelled = false;
                 } elseif ($matches[1] === "true") {
                     $ignoreCancelled = true;
                 }
             }
             $parameters = $method->getParameters();
             if (count($parameters) === 1 and $parameters[0]->getClass() instanceof \ReflectionClass and is_subclass_of($parameters[0]->getClass()->getName(), Event::class)) {
                 $class = $parameters[0]->getClass()->getName();
                 $reflection = new \ReflectionClass($class);
                 if (strpos((string) $reflection->getDocComment(), "@deprecated") !== false and $this->server->getProperty("settings.deprecated-verbose", true)) {
                     $this->server->getLogger()->warning($this->server->getLanguage()->translateString("pocketmine.plugin.deprecatedEvent", [$plugin->getName(), $class, get_class($listener) . "->" . $method->getName() . "()"]));
                 }
                 $this->registerEvent($class, $listener, $priority, new MethodEventExecutor($method->getName()), $plugin, $ignoreCancelled);
             }
         }
     }
 }
开发者ID:TylerGames,项目名称:PocketMine-MP,代码行数:44,代码来源:PluginManager.php

示例15: __construct

 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, $name, $path, $provider)
 {
     $this->blockStates = Block::$fullList;
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     $this->autoSave = $server->getAutoSave();
     /** @var LevelProvider $provider */
     if (is_subclass_of($provider, LevelProvider::class, true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new LevelException("Provider is not a subclass of LevelProvider");
     }
     $this->server->getLogger()->info("Preparing level \"" . $this->provider->getName() . "\"");
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 0);
     $this->chunkTickList = [];
     $this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", false);
     $this->timings = new LevelTimings($this);
     $this->temporalPosition = new Position(0, 0, 0, $this);
     $this->temporalVector = new Vector3(0, 0, 0);
 }
开发者ID:RedstoneAlmeida,项目名称:Steadfast2,代码行数:38,代码来源:Level.php


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