mirror of
				https://e.coding.net/circlecloud/Yum.git
				synced 2025-11-04 05:06:02 +00:00 
			
		
		
		
	@@ -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);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -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++;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user