feat: 完善Tab补全 添加玩家命令监控说明

Signed-off-by: 502647092 <admin@yumc.pw>
dev
502647092 2016-07-19 13:46:36 +08:00
parent e1b72c1b60
commit 58fe1d3f0c
2 changed files with 5 additions and 3 deletions

View File

@ -23,13 +23,15 @@ public class PluginTabComplete implements HandlerCommands {
final String[] args = e.getArgs();
if (args[0].equalsIgnoreCase("install") || args[0].equalsIgnoreCase("i")) {
return StrKit.copyPartialMatches(args[1], YumAPI.getRepo().getAllPluginName(), new ArrayList<String>());
} else if (args[0].equalsIgnoreCase("repo")) {
} else if (args[0].equalsIgnoreCase("repo") || args[0].equalsIgnoreCase("r")) {
if (args.length == 2) {
return StrKit.copyPartialMatches(args[1], Arrays.asList(new String[] { "add", "all", "list", "delall", "clean", "update", "del" }), new ArrayList<String>());
}
if (args.length == 3 && (args[1] == "add" || args[1] == "del")) {
return StrKit.copyPartialMatches(args[2], YumAPI.getRepo().getRepos().keySet(), new ArrayList<String>());
}
} else if (args[0].equalsIgnoreCase("bukkitrepo") || args[0].equalsIgnoreCase("br")) {
return StrKit.copyPartialMatches(args[1], Arrays.asList(new String[] { "look", "install" }), new ArrayList<String>());
} else {
return StrKit.copyPartialMatches(args[1], YumAPI.getPlugman().getPluginNames(false), new ArrayList<String>());
}

View File

@ -96,7 +96,7 @@ public class CommandInjector implements TabExecutor {
final long end = System.nanoTime();
final long lag = end - start;
if (Bukkit.isPrimaryThread() && lag / 1000000 > 10) {
PluginKit.sc("§6[§bYum §a能耗监控§6] §c注意! §6插件 §b" + plugin.getName() + " §6执行 §d" + label + " " + StrKit.join(args, " ") + " §6命令 §c耗时 §4" + lag / 1000000 + "ms!");
PluginKit.sc("§6[§bYum §a能耗监控§6] §c注意! §6玩家 §a" + sender.getName() + " §6执行 §b" + plugin.getName() + " §6插件 §d" + label + " " + StrKit.join(args, " ") + " §6命令 §c耗时 §4" + lag / 1000000 + "ms!");
}
totalTime += lag;
count++;
@ -106,7 +106,7 @@ public class CommandInjector implements TabExecutor {
e = e.getCause();
}
MonitorCommand.lastError = e;
PluginKit.sc(prefix + "§6插件 §b" + plugin.getName() + " §6执行 §d" + label + " §6命令时发生异常!");
PluginKit.sc(prefix + "§6玩家 §a" + sender.getName() + " §6执行 §b" + plugin.getName() + " §6插件 §d" + label + " " + StrKit.join(args, " ") + " §6命令时发生异常!");
PluginKit.sc("§6异常名称: §c" + e.getClass().getName());
PluginKit.sc("§6异常说明: §3" + e.getMessage());
PluginKit.sc("§6简易错误信息如下:");