本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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));
}
示例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;
}