From 0fcecd63cf3d3721185a5a4f009301be41e70341 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 19 Jul 2016 23:41:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=8C=89=E9=92=AE=E8=A7=A6=E5=8F=91=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- pom.xml | 5 ++--- src/main/java/pw/yumc/Yum/commands/YumCommand.java | 14 +++++++------- .../java/pw/yumc/Yum/inject/CommandInjector.java | 11 +++++------ .../java/pw/yumc/Yum/inject/ListenerInjector.java | 4 ++-- src/main/java/pw/yumc/Yum/inject/TaskInjector.java | 4 ++-- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 1fab04a..41a47a7 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 pw.yumc Yum - 2.6.5 + 2.6.6 Yum Minecraft 服务器插件管理系统 @@ -61,11 +61,10 @@ &a全新 2.X 版本 更多守护与优化 &c注意 &6- &cYum更新需要重启服务器!重启服务器!重启服务器!; + &b2.6.6 &6- &c修复快捷点击按钮触发命令错误...; &b2.6.5 &6- &c修复list命令 &a添加全局能耗统计...; &b2.6.4 &6- &e添加从&bBukkitDev&e下载和更新...; &b2.6.3 &6- &a注入操作延时执行 防止部分任务未注册 添加手动注入...; - &b2.6.2 &6- &d能耗监控添加忽略列表 &3详见monitor.yml...; - &b2.6.1 &6- &c优化能耗监控 命令别名修改为mi(防止与ESS冲突)...; DEBUG UTF-8 diff --git a/src/main/java/pw/yumc/Yum/commands/YumCommand.java b/src/main/java/pw/yumc/Yum/commands/YumCommand.java index 0e2bb1a..4899dec 100644 --- a/src/main/java/pw/yumc/Yum/commands/YumCommand.java +++ b/src/main/java/pw/yumc/Yum/commands/YumCommand.java @@ -98,7 +98,7 @@ public class YumCommand implements HandlerCommands, Listener { final FancyMessage fm = FancyMessage.newFM(); fm.text(String.format(filelist, f.name, f.gameVersion, f.releaseType)); fm.then(" "); - fm.then(install).command(String.format("yum br install %s %s", f.name, f.downloadUrl)); + fm.then(install).command(String.format("/yum br install %s %s", f.name, f.downloadUrl)); fm.send(sender); } break; @@ -246,15 +246,15 @@ public class YumCommand implements HandlerCommands, Listener { for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) { final String pname = plugin.getName(); final FancyMessage fm = FancyMessage.newFM(); - fm.text(String.format("§6- %-25s", YumAPI.getPlugman().getFormattedName(plugin, true))); + fm.text(String.format("§6- %-32s", YumAPI.getPlugman().getFormattedName(plugin, true))); fm.then(" "); - fm.then(update).command("yum u " + pname); + fm.then(update).command("/yum u " + pname); fm.then(" "); - fm.then(unload).command("yum unload " + pname); + fm.then(unload).command("/yum unload " + pname); fm.then(" "); - fm.then(reload).command("yum re " + pname); + fm.then(reload).command("/yum re " + pname); fm.then(" "); - fm.then(delete).command("yum del " + pname); + fm.then(delete).command("/yum del " + pname); fm.send(sender); } } @@ -381,7 +381,7 @@ public class YumCommand implements HandlerCommands, Listener { final FancyMessage fm = FancyMessage.newFM(); fm.text(String.format(bukkitlist, p.id, p.name, p.stage)); fm.then(" "); - fm.then(look).command("yum br look " + p.id); + fm.then(look).command("/yum br look " + p.id); fm.send(sender); } } diff --git a/src/main/java/pw/yumc/Yum/inject/CommandInjector.java b/src/main/java/pw/yumc/Yum/inject/CommandInjector.java index 45c3cf3..ddc899d 100644 --- a/src/main/java/pw/yumc/Yum/inject/CommandInjector.java +++ b/src/main/java/pw/yumc/Yum/inject/CommandInjector.java @@ -44,13 +44,11 @@ public class CommandInjector implements TabExecutor { final PluginCommand pluginCommand = (PluginCommand) command; final Plugin plugin = pluginCommand.getPlugin(); if (plugin.equals(toInjectPlugin)) { - CommandExecutor executor = Reflect.on(command).get("executor"); - TabCompleter completer = Reflect.on(command).get("completer");; + final CommandExecutor executor = Reflect.on(command).get("executor"); if (executor instanceof CommandInjector) { - final CommandInjector cInjector = (CommandInjector) executor; - executor = cInjector.getOriginalExecutor(); - completer = cInjector.getOriginalCompleter(); + return; } + final TabCompleter completer = Reflect.on(command).get("completer"); final CommandInjector commandInjector = new CommandInjector(executor, completer, toInjectPlugin); Reflect.on(command).set("executor", commandInjector); Reflect.on(command).set("completer", commandInjector); @@ -99,7 +97,8 @@ 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玩家 §a" + sender.getName() + " §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++; diff --git a/src/main/java/pw/yumc/Yum/inject/ListenerInjector.java b/src/main/java/pw/yumc/Yum/inject/ListenerInjector.java index 1c9731d..77a730a 100644 --- a/src/main/java/pw/yumc/Yum/inject/ListenerInjector.java +++ b/src/main/java/pw/yumc/Yum/inject/ListenerInjector.java @@ -41,9 +41,9 @@ public class ListenerInjector implements EventExecutor { if (listener instanceof TimedRegisteredListener) { return; } - EventExecutor originalExecutor = Reflect.on(listener).get("executor"); + final EventExecutor originalExecutor = Reflect.on(listener).get("executor"); if (originalExecutor instanceof ListenerInjector) { - originalExecutor = ((ListenerInjector) originalExecutor).getOriginalExecutor(); + return; } final ListenerInjector listenerInjector = new ListenerInjector(originalExecutor, plugin); Reflect.on(listener).set("executor", listenerInjector); diff --git a/src/main/java/pw/yumc/Yum/inject/TaskInjector.java b/src/main/java/pw/yumc/Yum/inject/TaskInjector.java index c569c46..a18ae14 100644 --- a/src/main/java/pw/yumc/Yum/inject/TaskInjector.java +++ b/src/main/java/pw/yumc/Yum/inject/TaskInjector.java @@ -39,9 +39,9 @@ public class TaskInjector implements Runnable { for (final BukkitTask pendingTask : pendingTasks) { // 忽略异步任务 if (pendingTask.isSync() && pendingTask.getOwner().equals(plugin)) { - Runnable originalTask = Reflect.on(pendingTask).get("task"); + final Runnable originalTask = Reflect.on(pendingTask).get("task"); if (originalTask instanceof TaskInjector) { - originalTask = ((TaskInjector) originalTask).getOriginalTask(); + return; } final TaskInjector taskInjector = new TaskInjector(originalTask, plugin); Reflect.on(pendingTask).set("task", taskInjector);