From 4866de48332348820c9f693e5fba9c908a116dcd Mon Sep 17 00:00:00 2001 From: 502647092 Date: Sat, 23 Jul 2016 18:31:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E5=A4=84=E7=90=86=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- pom.xml | 11 ++++++ .../BukkitInjectedTools/YumTestCommand.java | 37 +++++++++---------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 3d0f72c..6664fd5 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,7 @@ cn.citycraft:PluginHelper + pw.yumc:YumCore @@ -39,6 +40,10 @@ cn.citycraft.PluginHelper ${project.groupId}.${project.artifactId} + + pw.yumc.YumCore + ${project.groupId}.${project.artifactId} + @@ -88,5 +93,11 @@ jar 1.0 + + pw.yumc + YumCore + jar + 1.0 + \ No newline at end of file diff --git a/src/main/java/pw/yumc/BukkitInjectedTools/YumTestCommand.java b/src/main/java/pw/yumc/BukkitInjectedTools/YumTestCommand.java index a46b24d..0c1a8e8 100644 --- a/src/main/java/pw/yumc/BukkitInjectedTools/YumTestCommand.java +++ b/src/main/java/pw/yumc/BukkitInjectedTools/YumTestCommand.java @@ -7,46 +7,45 @@ import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import cn.citycraft.PluginHelper.bukkit.P; -import cn.citycraft.PluginHelper.commands.HandlerCommand; -import cn.citycraft.PluginHelper.commands.HandlerCommands; -import cn.citycraft.PluginHelper.commands.InvokeCommandEvent; -import cn.citycraft.PluginHelper.commands.InvokeSubCommand; import cn.citycraft.PluginHelper.kit.PluginKit; import cn.citycraft.PluginHelper.utils.IOUtil; import pw.yumc.BukkitInjectedTools.event.YumTestEvent; +import pw.yumc.YumCore.commands.CommandArgument; +import pw.yumc.YumCore.commands.CommandManager; +import pw.yumc.YumCore.commands.annotation.Cmd; +import pw.yumc.YumCore.commands.api.CommandExecutor; /** * * @since 2016年7月18日 下午7:03:06 * @author 喵♂呜 */ -public class YumTestCommand implements HandlerCommands { +public class YumTestCommand implements CommandExecutor { private final String prefix = "§6[§bYum §a注入工具§6]§r "; private boolean downloading = false; private String nfn = "null"; public YumTestCommand() { - final InvokeSubCommand isc = new InvokeSubCommand(P.instance, "BukkitInjectedTools"); - isc.registerCommands(this); + new CommandManager("bit", this); } - @HandlerCommand(name = "cmd") - public void cmd(final InvokeCommandEvent e) { + @Cmd + public void cmd(final CommandArgument e) { throw new IllegalArgumentException("Yum命令监控测试!"); } - @HandlerCommand(name = "event") - public void event(final InvokeCommandEvent e) { + @Cmd + public void event(final CommandArgument e) { Bukkit.getPluginManager().callEvent(new YumTestEvent()); } - @HandlerCommand(name = "inject") - public void inject(final InvokeCommandEvent e) throws IOException { + @Cmd + public void inject(final CommandArgument e) throws IOException { InjectedKit.injectSetOpMethod(e.getSender(), getDataFolder().getCanonicalPath() + File.separatorChar + "Bukkit"); } - @HandlerCommand(name = "net") - public void net(final InvokeCommandEvent e) throws IOException { + @Cmd + public void net(final CommandArgument e) throws IOException { if (downloading == true) { e.getSender().sendMessage(prefix + "§c正在主线程下载文件,请勿重复测试...!"); return; @@ -69,16 +68,16 @@ public class YumTestCommand implements HandlerCommands { }); } - @HandlerCommand(name = "op", minimumArguments = 1) - public void op(final InvokeCommandEvent e) { + @Cmd + public void op(final CommandArgument e) { e.getSender().sendMessage(prefix + "§cSetOp拦截测试!"); final OfflinePlayer op = Bukkit.getOfflinePlayer(e.getArgs()[0]); op.setOp(true); e.getSender().sendMessage(prefix + "§cSetOp拦截测试结束!"); } - @HandlerCommand(name = "thread") - public void thread(final InvokeCommandEvent e) throws IOException { + @Cmd + public void thread(final CommandArgument e) throws IOException { if (downloading == true) { e.getSender().sendMessage(prefix + "§c正在主线程下载文件,请勿重复测试...!"); return;