mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
feat: 修复快捷点击按钮触发命令错误
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
df4a8bc96f
commit
0fcecd63cf
5
pom.xml
5
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>pw.yumc</groupId>
|
<groupId>pw.yumc</groupId>
|
||||||
<artifactId>Yum</artifactId>
|
<artifactId>Yum</artifactId>
|
||||||
<version>2.6.5</version>
|
<version>2.6.6</version>
|
||||||
<name>Yum</name>
|
<name>Yum</name>
|
||||||
<description>Minecraft 服务器插件管理系统</description>
|
<description>Minecraft 服务器插件管理系统</description>
|
||||||
<build>
|
<build>
|
||||||
@ -61,11 +61,10 @@
|
|||||||
<update.description>&a全新 2.X 版本 更多守护与优化</update.description>
|
<update.description>&a全新 2.X 版本 更多守护与优化</update.description>
|
||||||
<update.changes>
|
<update.changes>
|
||||||
&c注意 &6- &cYum更新需要重启服务器!重启服务器!重启服务器!;
|
&c注意 &6- &cYum更新需要重启服务器!重启服务器!重启服务器!;
|
||||||
|
&b2.6.6 &6- &c修复快捷点击按钮触发命令错误...;
|
||||||
&b2.6.5 &6- &c修复list命令 &a添加全局能耗统计...;
|
&b2.6.5 &6- &c修复list命令 &a添加全局能耗统计...;
|
||||||
&b2.6.4 &6- &e添加从&bBukkitDev&e下载和更新...;
|
&b2.6.4 &6- &e添加从&bBukkitDev&e下载和更新...;
|
||||||
&b2.6.3 &6- &a注入操作延时执行 防止部分任务未注册 添加手动注入...;
|
&b2.6.3 &6- &a注入操作延时执行 防止部分任务未注册 添加手动注入...;
|
||||||
&b2.6.2 &6- &d能耗监控添加忽略列表 &3详见monitor.yml...;
|
|
||||||
&b2.6.1 &6- &c优化能耗监控 命令别名修改为mi(防止与ESS冲突)...;
|
|
||||||
</update.changes>
|
</update.changes>
|
||||||
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -98,7 +98,7 @@ public class YumCommand implements HandlerCommands, Listener {
|
|||||||
final FancyMessage fm = FancyMessage.newFM();
|
final FancyMessage fm = FancyMessage.newFM();
|
||||||
fm.text(String.format(filelist, f.name, f.gameVersion, f.releaseType));
|
fm.text(String.format(filelist, f.name, f.gameVersion, f.releaseType));
|
||||||
fm.then(" ");
|
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);
|
fm.send(sender);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -246,15 +246,15 @@ public class YumCommand implements HandlerCommands, Listener {
|
|||||||
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||||
final String pname = plugin.getName();
|
final String pname = plugin.getName();
|
||||||
final FancyMessage fm = FancyMessage.newFM();
|
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(" ");
|
||||||
fm.then(update).command("yum u " + pname);
|
fm.then(update).command("/yum u " + pname);
|
||||||
fm.then(" ");
|
fm.then(" ");
|
||||||
fm.then(unload).command("yum unload " + pname);
|
fm.then(unload).command("/yum unload " + pname);
|
||||||
fm.then(" ");
|
fm.then(" ");
|
||||||
fm.then(reload).command("yum re " + pname);
|
fm.then(reload).command("/yum re " + pname);
|
||||||
fm.then(" ");
|
fm.then(" ");
|
||||||
fm.then(delete).command("yum del " + pname);
|
fm.then(delete).command("/yum del " + pname);
|
||||||
fm.send(sender);
|
fm.send(sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -381,7 +381,7 @@ public class YumCommand implements HandlerCommands, Listener {
|
|||||||
final FancyMessage fm = FancyMessage.newFM();
|
final FancyMessage fm = FancyMessage.newFM();
|
||||||
fm.text(String.format(bukkitlist, p.id, p.name, p.stage));
|
fm.text(String.format(bukkitlist, p.id, p.name, p.stage));
|
||||||
fm.then(" ");
|
fm.then(" ");
|
||||||
fm.then(look).command("yum br look " + p.id);
|
fm.then(look).command("/yum br look " + p.id);
|
||||||
fm.send(sender);
|
fm.send(sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,11 @@ public class CommandInjector implements TabExecutor {
|
|||||||
final PluginCommand pluginCommand = (PluginCommand) command;
|
final PluginCommand pluginCommand = (PluginCommand) command;
|
||||||
final Plugin plugin = pluginCommand.getPlugin();
|
final Plugin plugin = pluginCommand.getPlugin();
|
||||||
if (plugin.equals(toInjectPlugin)) {
|
if (plugin.equals(toInjectPlugin)) {
|
||||||
CommandExecutor executor = Reflect.on(command).get("executor");
|
final CommandExecutor executor = Reflect.on(command).get("executor");
|
||||||
TabCompleter completer = Reflect.on(command).get("completer");;
|
|
||||||
if (executor instanceof CommandInjector) {
|
if (executor instanceof CommandInjector) {
|
||||||
final CommandInjector cInjector = (CommandInjector) executor;
|
return;
|
||||||
executor = cInjector.getOriginalExecutor();
|
|
||||||
completer = cInjector.getOriginalCompleter();
|
|
||||||
}
|
}
|
||||||
|
final TabCompleter completer = Reflect.on(command).get("completer");
|
||||||
final CommandInjector commandInjector = new CommandInjector(executor, completer, toInjectPlugin);
|
final CommandInjector commandInjector = new CommandInjector(executor, completer, toInjectPlugin);
|
||||||
Reflect.on(command).set("executor", commandInjector);
|
Reflect.on(command).set("executor", commandInjector);
|
||||||
Reflect.on(command).set("completer", commandInjector);
|
Reflect.on(command).set("completer", commandInjector);
|
||||||
@ -99,7 +97,8 @@ public class CommandInjector implements TabExecutor {
|
|||||||
final long end = System.nanoTime();
|
final long end = System.nanoTime();
|
||||||
final long lag = end - start;
|
final long lag = end - start;
|
||||||
if (Bukkit.isPrimaryThread() && lag / 1000000 > 10) {
|
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;
|
totalTime += lag;
|
||||||
count++;
|
count++;
|
||||||
|
@ -41,9 +41,9 @@ public class ListenerInjector implements EventExecutor {
|
|||||||
if (listener instanceof TimedRegisteredListener) {
|
if (listener instanceof TimedRegisteredListener) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EventExecutor originalExecutor = Reflect.on(listener).get("executor");
|
final EventExecutor originalExecutor = Reflect.on(listener).get("executor");
|
||||||
if (originalExecutor instanceof ListenerInjector) {
|
if (originalExecutor instanceof ListenerInjector) {
|
||||||
originalExecutor = ((ListenerInjector) originalExecutor).getOriginalExecutor();
|
return;
|
||||||
}
|
}
|
||||||
final ListenerInjector listenerInjector = new ListenerInjector(originalExecutor, plugin);
|
final ListenerInjector listenerInjector = new ListenerInjector(originalExecutor, plugin);
|
||||||
Reflect.on(listener).set("executor", listenerInjector);
|
Reflect.on(listener).set("executor", listenerInjector);
|
||||||
|
@ -39,9 +39,9 @@ public class TaskInjector implements Runnable {
|
|||||||
for (final BukkitTask pendingTask : pendingTasks) {
|
for (final BukkitTask pendingTask : pendingTasks) {
|
||||||
// 忽略异步任务
|
// 忽略异步任务
|
||||||
if (pendingTask.isSync() && pendingTask.getOwner().equals(plugin)) {
|
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) {
|
if (originalTask instanceof TaskInjector) {
|
||||||
originalTask = ((TaskInjector) originalTask).getOriginalTask();
|
return;
|
||||||
}
|
}
|
||||||
final TaskInjector taskInjector = new TaskInjector(originalTask, plugin);
|
final TaskInjector taskInjector = new TaskInjector(originalTask, plugin);
|
||||||
Reflect.on(pendingTask).set("task", taskInjector);
|
Reflect.on(pendingTask).set("task", taskInjector);
|
||||||
|
Loading…
Reference in New Issue
Block a user