From bd273fcc31825474ae351ff371e4536c30d3d549 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Fri, 3 Jun 2016 23:57:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0BukkitDev=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=20=E6=B7=BB=E5=8A=A0=E5=91=BD=E4=BB=A4=E5=88=AB?= =?UTF-8?q?=E5=90=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../java/pw/yumc/Yum/commands/YumCommand.java | 33 +++++++++++++++---- .../java/pw/yumc/Yum/models/BukkitDev.java | 9 +++++ src/main/resources/plugin.yml | 4 +-- 3 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 src/main/java/pw/yumc/Yum/models/BukkitDev.java diff --git a/src/main/java/pw/yumc/Yum/commands/YumCommand.java b/src/main/java/pw/yumc/Yum/commands/YumCommand.java index 3381cc2..3d27ba9 100644 --- a/src/main/java/pw/yumc/Yum/commands/YumCommand.java +++ b/src/main/java/pw/yumc/Yum/commands/YumCommand.java @@ -120,6 +120,7 @@ public class YumCommand implements HandlerCommands, Listener { sender.sendMessage("§6插件注册命令: §3" + (clist.isEmpty() ? "无" : "")); for (final Entry> entry : clist.entrySet()) { sender.sendMessage("§6 - §a" + entry.getKey()); + sendEntryList(sender, "§6 别名: §a", entry.getValue(), "aliases"); sendEntry(sender, "§6 描述: §a", entry.getValue(), "description"); sendEntry(sender, "§6 权限: §a", entry.getValue(), "permission"); sendEntry(sender, "§6 用法: §a", entry.getValue(), "usage"); @@ -172,19 +173,17 @@ public class YumCommand implements HandlerCommands, Listener { @HandlerTabComplete() public List listtab(final InvokeCommandEvent e) { final String[] args = e.getArgs(); - if (!args[0].equalsIgnoreCase("install") && !args[0].equalsIgnoreCase("repo")) { - return StrKit.copyPartialMatches(args[1], plugman.getPluginNames(false), new ArrayList()); - } - if (args[0].equalsIgnoreCase("install")) { + if (args[0].equalsIgnoreCase("install") || args[0].equalsIgnoreCase("i")) { return StrKit.copyPartialMatches(args[1], repo.getAllPluginName(), new ArrayList()); - } - if (args[0].equalsIgnoreCase("repo")) { + } else if (args[0].equalsIgnoreCase("repo")) { if (args.length == 2) { return StrKit.copyPartialMatches(args[1], Arrays.asList(new String[] { "add", "all", "list", "delall", "clean", "update", "del" }), new ArrayList()); } if (args.length == 3 && (args[1] == "add" || args[1] == "del")) { return StrKit.copyPartialMatches(args[2], repo.getRepos().keySet(), new ArrayList()); } + } else { + return StrKit.copyPartialMatches(args[1], plugman.getPluginNames(false), new ArrayList()); } return null; } @@ -302,6 +301,28 @@ public class YumCommand implements HandlerCommands, Listener { } } + /** + * 发生实体消息 + * + * @param sender + * 命令发送者 + * @param prefix + * 实体前缀 + * @param map + * 实体 + * @param key + * 实体Key + */ + @SuppressWarnings("unchecked") + public void sendEntryList(final CommandSender sender, final String prefix, final Map map, final String key) { + final List values = (List) map.get(key); + if (values != null) { + for (final String value : values) { + sender.sendMessage(prefix + value); + } + } + } + @HandlerCommand(name = "unload", minimumArguments = 1, description = "卸载插件", possibleArguments = "<插件名称>") public void unload(final InvokeCommandEvent e) { final String pluginname = e.getArgs()[0]; diff --git a/src/main/java/pw/yumc/Yum/models/BukkitDev.java b/src/main/java/pw/yumc/Yum/models/BukkitDev.java new file mode 100644 index 0000000..ae0f883 --- /dev/null +++ b/src/main/java/pw/yumc/Yum/models/BukkitDev.java @@ -0,0 +1,9 @@ +package pw.yumc.Yum.models; + +import java.io.Serializable; +import java.util.List; + +public class BukkitDev implements Serializable { + public String name; + public List pil; +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 84245a7..62888ce 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -26,9 +26,9 @@ commands: permission-message: §c你没有 的权限来执行此命令! security: description: MC安全管理命令 - aliases: [f] + aliases: [s] usage: §6使用§a/security help§6查看帮助! - permission: file.use + permission: security.use permission-message: §c你没有 的权限来执行此命令! permissions: yum.use: