feat: 使用新的命令处理系统

Signed-off-by: 502647092 <admin@yumc.pw>
master
502647092 2016-07-23 18:31:04 +08:00
parent 2fea72976d
commit 4866de4833
2 changed files with 29 additions and 19 deletions

11
pom.xml
View File

@ -32,6 +32,7 @@
<artifactSet>
<includes>
<include>cn.citycraft:PluginHelper</include>
<include>pw.yumc:YumCore</include>
</includes>
</artifactSet>
<relocations>
@ -39,6 +40,10 @@
<pattern>cn.citycraft.PluginHelper</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
</relocation>
<relocation>
<pattern>pw.yumc.YumCore</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
@ -88,5 +93,11 @@
<type>jar</type>
<version>1.0</version>
</dependency>
<dependency>
<groupId>pw.yumc</groupId>
<artifactId>YumCore</artifactId>
<type>jar</type>
<version>1.0</version>
</dependency>
</dependencies>
</project>

View File

@ -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 2016718 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;