當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。