本文整理汇总了PHP中pocketmine\plugin\Plugin::getDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::getDescription方法的具体用法?PHP Plugin::getDescription怎么用?PHP Plugin::getDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\plugin\Plugin
的用法示例。
在下文中一共展示了Plugin::getDescription方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUniversalMysqliDatabase
public function getUniversalMysqliDatabase(Plugin $ctx, $disableOnFailure = true)
{
if (!$this->universalMysqli instanceof \mysqli) {
$data = $this->getXEconConfiguration()->getUniMysqlDetails();
$this->universalMysqli = @new \mysqli($data["host"], $data["username"], $data["password"], $data["database"], $data["port"]);
if ($this->universalMysqli->connect_error) {
$ctx->getLogger()->critical("Failed to connect to the xEcon universal MySQL database! " . "Reason: {$this->universalMysqli->connect_error}");
if ($disableOnFailure) {
if ($ctx !== $this) {
$desc = $ctx->getDescription();
$this->getLogger()->critical("Disabling {$desc->getFullName()} by " . implode(", ", $desc->getAuthors()) . " because the required universal " . "MySQL database cannot be connected to.");
} else {
$this->getLogger()->critical("Disabling due to required universal MySQL database not connectable.");
}
$ctx->getPluginLoader()->disablePlugin($ctx);
}
$this->universalMysqli = null;
}
}
return $this->universalMysqli;
}
示例2: __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;
}
示例3: prepareData
private function prepareData(Plugin $plugin, \Exception $e, $event)
{
$desc = $plugin->getDescription();
$sha = false;
$class = new \ReflectionClass($plugin);
$file = $class->getProperty("file");
$file->setAccessible(true);
$path = $file->getValue($plugin);
$file->setAccessible(false);
$path = realpath("{$path}/.git/refs/heads/master");
if (is_file($path)) {
$sha = trim(file_get_contents($path));
}
$this->payload = serialize(["repo" => "LegendOfMCPE/xEcon", "plugin" => ["name" => $desc->getName(), "version" => $desc->getVersion()], "event" => $event, "exception" => ["class" => get_class($e), "message" => $e->getMessage(), "trace" => $e->getTraceAsString(), "trace-array" => $e->getTrace(), "file" => $e->getFile(), "line" => $e->getLine(), "code" => $e->getCode()], "sha" => $sha]);
}
示例4: describeToSender
private function describeToSender(Plugin $plugin, CommandSender $sender)
{
$desc = $plugin->getDescription();
$sender->sendMessage(TextFormat::DARK_GREEN . $desc->getName() . TextFormat::WHITE . " version " . TextFormat::DARK_GREEN . $desc->getVersion());
if ($desc->getDescription() != null) {
$sender->sendMessage($desc->getDescription());
}
if ($desc->getWebsite() != null) {
$sender->sendMessage("Website: " . $desc->getWebsite());
}
if (count($authors = $desc->getAuthors()) > 0) {
if (count($authors) === 1) {
$sender->sendMessage("Author: " . implode(", ", $authors));
} else {
$sender->sendMessage("Authors: " . implode(", ", $authors));
}
}
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: 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));
}
示例9: __construct
/**
* @param Plugin $context
*/
public function __construct(Plugin $context)
{
$prefix = $context->getDescription()->getPrefix();
$this->pluginName = $prefix != null ? "[{$prefix}] " : "[" . $context->getDescription()->getName() . "] ";
}
示例10: 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;
}
示例11: cmdInfo
private function cmdInfo(CommandSender $c, Plugin $p, $pageNumber)
{
$txt = [];
$desc = $p->getDescription();
$txt[] = TextFormat::AQUA . mc::_("Plugin: %1%", $desc->getFullName());
if ($desc->getDescription()) {
$txt[] = TextFormat::GREEN . mc::_("Description: ") . TextFormat::WHITE . $desc->getDescription();
}
if ($desc->getPrefix()) {
$txt[] = TextFormat::GREEN . mc::_("Prefix: ") . ($txt[] = TextFormat::GREEN . mc::_("Main Class: ") . TextFormat::WHITE . $desc->getMain());
}
if ($desc->getWebsite()) {
$txt[] = TextFormat::GREEN . mc::_("WebSite: ") . TextFormat::WHITE . $desc->getWebsite();
}
if (count($desc->getCompatibleApis())) {
$txt[] = TextFormat::GREEN . mc::_("APIs: ") . TextFormat::WHITE . implode(TextFormat::BLUE . ", " . TextFormat::WHITE, $desc->getCompatibleApis());
}
if (count($desc->getAuthors())) {
$txt[] = TextFormat::GREEN . mc::_("Authors: ") . TextFormat::WHITE . implode(TextFormat::BLUE . ", " . TextFormat::WHITE, $desc->getAuthors());
}
if (count($desc->getDepend())) {
$txt[] = TextFormat::GREEN . mc::_("Dependancies: ") . TextFormat::WHITE . implode(TextFormat::BLUE . ", " . TextFormat::WHITE, $desc->getDepend());
}
if (count($desc->getSoftDepend())) {
$txt[] = TextFormat::GREEN . mc::_("Soft-Dependancies: ") . TextFormat::WHITE . implode(TextFormat::BLUE . ", " . TextFormat::WHITE, $desc->getSoftDepend());
}
if (count($desc->getLoadBefore())) {
$txt[] = TextFormat::GREEN . mc::_("Load Before: ") . TextFormat::WHITE . implode(TextFormat::BLUE . ", " . TextFormat::WHITE, $desc->getLoadBefore());
}
if (($cnt = count($desc->getCommands())) > 0) {
$txt[] = TextFormat::GREEN . mc::_("Commands: ") . TextFormat::WHITE . $cnt;
}
if (($cnt = count($desc->getPermissions())) > 0) {
$txt[] = TextFormat::GREEN . mc::_("Permissions: ") . TextFormat::WHITE . $cnt;
}
$loader = explode("\\", get_class($p->getPluginLoader()));
$txt[] = TextFormat::GREEN . mc::_("PluginLoader: ") . TextFormat::WHITE . array_pop($loader);
$file = $this->getPluginFilePath($p);
$txt[] = TextFormat::GREEN . mc::_("FileName: ") . TextFormat::WHITE . $file;
return $this->paginateText($c, $pageNumber, $txt);
}