添加yum info指令查看插件权限和注册命令...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-12-28 00:34:44 +08:00
parent 41fbadad61
commit c84655ddc6
2 changed files with 18 additions and 4 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>cn.citycraft</groupId> <groupId>cn.citycraft</groupId>
<artifactId>Yum</artifactId> <artifactId>Yum</artifactId>
<version>1.9.3</version> <version>1.9.5</version>
<name>Yum</name> <name>Yum</name>
<description>Minecraft 服务器插件管理系统</description> <description>Minecraft 服务器插件管理系统</description>
<build> <build>
@ -55,7 +55,7 @@
</build> </build>
<properties> <properties>
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url> <jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
<update.description>&amp;c清理无用模块 整合file功能...</update.description> <update.description>&amp;e添加yum info指令查看插件权限和注册命令...</update.description>
<env.BUILD_NUMBER>Debug</env.BUILD_NUMBER> <env.BUILD_NUMBER>Debug</env.BUILD_NUMBER>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>

View File

@ -5,11 +5,13 @@ package cn.citycraft.Yum.commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandException; import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;
@ -47,10 +49,22 @@ public class CommandInfo extends BaseCommand {
sender.sendMessage("§6插件版本: §3" + desc.getVersion()); sender.sendMessage("§6插件版本: §3" + desc.getVersion());
sender.sendMessage("§6插件作者: §3" + StringUtils.join(desc.getAuthors(), " ")); sender.sendMessage("§6插件作者: §3" + StringUtils.join(desc.getAuthors(), " "));
sender.sendMessage("§6插件描述: §3" + (desc.getDescription() == null ? "" : desc.getDescription())); sender.sendMessage("§6插件描述: §3" + (desc.getDescription() == null ? "" : desc.getDescription()));
sender.sendMessage("§6插件依赖: §3" + (desc.getDepend().size() == 0 ? "" : "")); sender.sendMessage("§6插件依赖: §3" + (desc.getDepend().isEmpty() ? "" : ""));
StringUtil.sendStringArray(sender, desc.getDepend(), "§6 - §a"); StringUtil.sendStringArray(sender, desc.getDepend(), "§6 - §a");
sender.sendMessage("§6插件软依赖: §3" + (desc.getSoftDepend().size() == 0 ? "" : "")); sender.sendMessage("§6插件软依赖: §3" + (desc.getSoftDepend().isEmpty() ? "" : ""));
StringUtil.sendStringArray(sender, desc.getSoftDepend(), "§6 - §a"); StringUtil.sendStringArray(sender, desc.getSoftDepend(), "§6 - §a");
final Map<String, Map<String, Object>> clist = desc.getCommands();
if (clist != null) {
sender.sendMessage("§6插件注册命令: §3" + (clist.isEmpty() ? "" : ""));
StringUtil.sendStringArray(sender, clist.keySet(), "§6 - §a");
}
final List<Permission> plist = desc.getPermissions();
if (plist != null) {
sender.sendMessage("§6插件注册权限: " + (plist.isEmpty() ? "" : ""));
for (final Permission perm : plist) {
sender.sendMessage("§6 - §a" + perm.getName() + "§6 - §e" + (perm.getDescription().isEmpty() ? "无描述" : perm.getDescription()));
}
}
sender.sendMessage("§6插件物理路径: §3" + YumAPI.getPlugman().getPluginFile(plugin).getAbsolutePath()); sender.sendMessage("§6插件物理路径: §3" + YumAPI.getPlugman().getPluginFile(plugin).getAbsolutePath());
} else { } else {
sender.sendMessage("§4错误: §c插件 " + pluginname + " 不存在或已卸载!"); sender.sendMessage("§4错误: §c插件 " + pluginname + " 不存在或已卸载!");