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


PHP Plugin::getName方法代码示例

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


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

示例1: getInstance

 /**
  * @param Plugin $plugin
  *
  * @return EconomyAPIListener
  */
 public static function getInstance(Plugin $plugin)
 {
     if (!isset(self::$instance[$plugin->getName()])) {
         self::$instance[$plugin->getName()] = new EconomyAPIListener($plugin);
     }
     return self::$instance[$plugin->getName()];
 }
开发者ID:ChalkPE,项目名称:ExamplePlugin,代码行数:12,代码来源:EconomyAPIListener.php

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

示例3: registerExtension

 public function registerExtension(Plugin $extension)
 {
     array_push($this->extensions, $extension->getName());
 }
开发者ID:AndreyNazarchuk,项目名称:Collection-Plugins-PocketMine-Prax,代码行数:4,代码来源:EssentialsPEChat.php

示例4: 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

示例5: __construct

 /**
  * @param Plugin	$owner
  * @param str 		$callable		method from $owner to call
  * @param array   $args				arguments to pass to callback method
  */
 public function __construct(Plugin $owner, $callable, array $args = [])
 {
     $this->owner = $owner->getName();
     $this->callable = $callable;
     $this->args = $args;
 }
开发者ID:Gabriel865,项目名称:pocketmine-plugins,代码行数:11,代码来源:PluginAsyncTask.php

示例6: 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

示例7: cmdCmds

 private function cmdCmds(CommandSender $c, Plugin $p, $pageNumber)
 {
     $desc = $p->getDescription();
     $cmds = $desc->getCommands();
     if (count($cmds) == 0) {
         $c->sendMessage(TextFormat::RED, mc::_("%1% has no configured commands", $p->getName()));
         return true;
     }
     $txt = [];
     $txt[] = TextFormat::AQUA . mc::_("Plugin: %1%", $desc->getFullName());
     foreach ($cmds as $i => $j) {
         $d = isset($j["description"]) ? $j["description"] : "";
         $txt[] = TextFormat::GREEN . $i . ": " . TextFormat::WHITE . $d;
     }
     return $this->paginateText($c, $pageNumber, $txt);
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:16,代码来源:CmdPluginMgr.php


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