mirror of
https://e.coding.net/circlecloud/BukkitInjectedTools.git
synced 2024-11-22 01:48:45 +00:00
feat: 使用新的命令处理系统
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
2fea72976d
commit
4866de4833
11
pom.xml
11
pom.xml
@ -32,6 +32,7 @@
|
|||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>cn.citycraft:PluginHelper</include>
|
<include>cn.citycraft:PluginHelper</include>
|
||||||
|
<include>pw.yumc:YumCore</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
@ -39,6 +40,10 @@
|
|||||||
<pattern>cn.citycraft.PluginHelper</pattern>
|
<pattern>cn.citycraft.PluginHelper</pattern>
|
||||||
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>pw.yumc.YumCore</pattern>
|
||||||
|
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
||||||
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
@ -88,5 +93,11 @@
|
|||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>pw.yumc</groupId>
|
||||||
|
<artifactId>YumCore</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -7,46 +7,45 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
|
||||||
import cn.citycraft.PluginHelper.bukkit.P;
|
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.kit.PluginKit;
|
||||||
import cn.citycraft.PluginHelper.utils.IOUtil;
|
import cn.citycraft.PluginHelper.utils.IOUtil;
|
||||||
import pw.yumc.BukkitInjectedTools.event.YumTestEvent;
|
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
|
* @since 2016年7月18日 下午7:03:06
|
||||||
* @author 喵♂呜
|
* @author 喵♂呜
|
||||||
*/
|
*/
|
||||||
public class YumTestCommand implements HandlerCommands {
|
public class YumTestCommand implements CommandExecutor {
|
||||||
private final String prefix = "§6[§bYum §a注入工具§6]§r ";
|
private final String prefix = "§6[§bYum §a注入工具§6]§r ";
|
||||||
private boolean downloading = false;
|
private boolean downloading = false;
|
||||||
private String nfn = "null";
|
private String nfn = "null";
|
||||||
|
|
||||||
public YumTestCommand() {
|
public YumTestCommand() {
|
||||||
final InvokeSubCommand isc = new InvokeSubCommand(P.instance, "BukkitInjectedTools");
|
new CommandManager("bit", this);
|
||||||
isc.registerCommands(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@HandlerCommand(name = "cmd")
|
@Cmd
|
||||||
public void cmd(final InvokeCommandEvent e) {
|
public void cmd(final CommandArgument e) {
|
||||||
throw new IllegalArgumentException("Yum命令监控测试!");
|
throw new IllegalArgumentException("Yum命令监控测试!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@HandlerCommand(name = "event")
|
@Cmd
|
||||||
public void event(final InvokeCommandEvent e) {
|
public void event(final CommandArgument e) {
|
||||||
Bukkit.getPluginManager().callEvent(new YumTestEvent());
|
Bukkit.getPluginManager().callEvent(new YumTestEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@HandlerCommand(name = "inject")
|
@Cmd
|
||||||
public void inject(final InvokeCommandEvent e) throws IOException {
|
public void inject(final CommandArgument e) throws IOException {
|
||||||
InjectedKit.injectSetOpMethod(e.getSender(), getDataFolder().getCanonicalPath() + File.separatorChar + "Bukkit");
|
InjectedKit.injectSetOpMethod(e.getSender(), getDataFolder().getCanonicalPath() + File.separatorChar + "Bukkit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@HandlerCommand(name = "net")
|
@Cmd
|
||||||
public void net(final InvokeCommandEvent e) throws IOException {
|
public void net(final CommandArgument e) throws IOException {
|
||||||
if (downloading == true) {
|
if (downloading == true) {
|
||||||
e.getSender().sendMessage(prefix + "§c正在主线程下载文件,请勿重复测试...!");
|
e.getSender().sendMessage(prefix + "§c正在主线程下载文件,请勿重复测试...!");
|
||||||
return;
|
return;
|
||||||
@ -69,16 +68,16 @@ public class YumTestCommand implements HandlerCommands {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@HandlerCommand(name = "op", minimumArguments = 1)
|
@Cmd
|
||||||
public void op(final InvokeCommandEvent e) {
|
public void op(final CommandArgument e) {
|
||||||
e.getSender().sendMessage(prefix + "§cSetOp拦截测试!");
|
e.getSender().sendMessage(prefix + "§cSetOp拦截测试!");
|
||||||
final OfflinePlayer op = Bukkit.getOfflinePlayer(e.getArgs()[0]);
|
final OfflinePlayer op = Bukkit.getOfflinePlayer(e.getArgs()[0]);
|
||||||
op.setOp(true);
|
op.setOp(true);
|
||||||
e.getSender().sendMessage(prefix + "§cSetOp拦截测试结束!");
|
e.getSender().sendMessage(prefix + "§cSetOp拦截测试结束!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@HandlerCommand(name = "thread")
|
@Cmd
|
||||||
public void thread(final InvokeCommandEvent e) throws IOException {
|
public void thread(final CommandArgument e) throws IOException {
|
||||||
if (downloading == true) {
|
if (downloading == true) {
|
||||||
e.getSender().sendMessage(prefix + "§c正在主线程下载文件,请勿重复测试...!");
|
e.getSender().sendMessage(prefix + "§c正在主线程下载文件,请勿重复测试...!");
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user