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


PHP Plugin::isEnabled方法代码示例

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


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

示例1: execute

 public function execute(CommandSender $sender, $commandLabel, array $args)
 {
     if (!$this->owningPlugin->isEnabled()) {
         return \false;
     }
     if (!$this->testPermission($sender)) {
         return \false;
     }
     $success = $this->executor->onCommand($sender, $this, $commandLabel, $args);
     if (!$success and $this->usageMessage !== "") {
         $sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
     }
     return $success;
 }
开发者ID:Edwardthedog2,项目名称:Steadfast2,代码行数:14,代码来源:PluginCommand.php

示例2: execute

 public function execute(CommandSender $sender, $commandLabel, array $args)
 {
     if (!$this->owningPlugin->isEnabled()) {
         return false;
     }
     if (!$this->testPermission($sender)) {
         return false;
     }
     $success = $this->executor->onCommand($sender, $this, $commandLabel, $args);
     if (!$success and $this->usageMessage !== "") {
         $sender->sendMessage(new TranslationContainer("commands.generic.usage", [$this->usageMessage]));
     }
     return $success;
 }
开发者ID:xxFlare,项目名称:PocketMine-MP,代码行数:14,代码来源:PluginCommand.php

示例3: __construct

 /**
  * @param Plugin      $plugin
  * @param Permissible $permissible
  *
  * @throws PluginException
  */
 public function __construct(Plugin $plugin, Permissible $permissible)
 {
     if (!$plugin->isEnabled()) {
         throw new PluginException("Plugin " . $plugin->getDescription()->getName() . " is disabled");
     }
     $this->permissible = $permissible;
     $this->plugin = $plugin;
 }
开发者ID:zzz1999,项目名称:ImagicalMine,代码行数:14,代码来源:PermissionAttachment.php

示例4: disablePlugin

 /**
  * @param Plugin $plugin
  */
 public function disablePlugin(Plugin $plugin)
 {
     if ($plugin instanceof PluginBase and $plugin->isEnabled()) {
         MainLogger::getLogger()->info("Disabling " . $plugin->getDescription()->getFullName());
         Server::getInstance()->getPluginManager()->callEvent(new PluginDisableEvent($plugin));
         $plugin->setEnabled(false);
     }
 }
开发者ID:applqpak,项目名称:plugin-remakes,代码行数:11,代码来源:FolderPluginLoader.php

示例5: disablePlugin

 /**
  * @param Plugin $plugin
  */
 public function disablePlugin(Plugin $plugin)
 {
     if ($plugin instanceof PluginBase and $plugin->isEnabled()) {
         $this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.plugin.disable", [$plugin->getDescription()->getFullName()]));
         $this->server->getPluginManager()->callEvent(new PluginDisableEvent($plugin));
         $plugin->setEnabled(false);
     }
 }
开发者ID:ianju,项目名称:PocketMine-MP,代码行数:11,代码来源:ScriptPluginLoader.php

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

示例7: registerEvent

 /**
  * @param string        $event Class name that extends Event
  * @param Listener      $listener
  * @param int           $priority
  * @param EventExecutor $executor
  * @param Plugin        $plugin
  * @param bool          $ignoreCancelled
  *
  * @throws PluginException
  */
 public function registerEvent($event, Listener $listener, $priority, EventExecutor $executor, Plugin $plugin, $ignoreCancelled = false)
 {
     if (!is_subclass_of($event, Event::class) or (new \ReflectionClass($event))->isAbstract()) {
         throw new PluginException($event . " is not a valid Event");
     }
     if (!$plugin->isEnabled()) {
         throw new PluginException("Plugin attempted to register " . $event . " while not enabled");
     }
     $timings = new TimingsHandler("Plugin: " . $plugin->getDescription()->getFullName() . " Event: " . get_class($listener) . "::" . ($executor instanceof MethodEventExecutor ? $executor->getMethod() : "???") . "(" . (new \ReflectionClass($event))->getShortName() . ")", self::$pluginParentTimer);
     $this->getEventListeners($event)->register(new RegisteredListener($listener, $executor, $priority, $plugin, $ignoreCancelled, $timings));
 }
开发者ID:TylerGames,项目名称:PocketMine-MP,代码行数:21,代码来源:PluginManager.php

示例8: addAttachment

 /**
  * //TODO: tick scheduled attachments
  *
  * @param Plugin $plugin
  * @param string $name
  * @param bool   $value
  *
  * @return PermissionAttachment
  *
  * @throws \Exception
  */
 public function addAttachment(Plugin $plugin, $name = null, $value = null)
 {
     if ($plugin === null) {
         throw new \Exception("Plugin cannot be null");
     } elseif (!$plugin->isEnabled()) {
         throw new \Exception("Plugin " . $plugin->getDescription()->getName() . " is disabled");
     }
     $result = new PermissionAttachment($plugin, $this->parent);
     $this->attachments[spl_object_hash($result)] = $result;
     if ($name !== null and $value !== null) {
         $result->setPermission($name, $value);
     }
     $this->recalculatePermissions();
     return $result;
 }
开发者ID:boybook,项目名称:PocketMine-MP,代码行数:26,代码来源:PermissibleBase.php


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