1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-24 02:08:48 +00:00

release: update to 1.9.1

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2020-12-23 13:51:13 +08:00
parent 1e115b3cab
commit f130cfed60
2 changed files with 9 additions and 15 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId> <groupId>pw.yumc</groupId>
<artifactId>YumCore</artifactId> <artifactId>YumCore</artifactId>
<version>1.9.0</version> <version>1.9.1</version>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<plugins> <plugins>

View File

@ -1,17 +1,9 @@
package pw.yumc.YumCore.commands; package pw.yumc.YumCore.commands;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import pw.yumc.YumCore.bukkit.Log; import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.bukkit.P; import pw.yumc.YumCore.bukkit.P;
import pw.yumc.YumCore.commands.annotation.Help; import pw.yumc.YumCore.commands.annotation.Help;
@ -19,6 +11,9 @@ import pw.yumc.YumCore.commands.info.CommandInfo;
import pw.yumc.YumCore.commands.interfaces.Executor; import pw.yumc.YumCore.commands.interfaces.Executor;
import pw.yumc.YumCore.commands.interfaces.HelpGenerator; import pw.yumc.YumCore.commands.interfaces.HelpGenerator;
import java.lang.reflect.Method;
import java.util.*;
/** /**
* 主类命令管理 * 主类命令管理
* *
@ -47,8 +42,7 @@ public class CommandMain implements CommandExecutor {
/** /**
* 主类命令管理类 * 主类命令管理类
* *
* @param clazzs * @param clazzs 命令类
* 命令类
*/ */
public CommandMain(Executor... clazzs) { public CommandMain(Executor... clazzs) {
register(clazzs); register(clazzs);
@ -57,8 +51,7 @@ public class CommandMain implements CommandExecutor {
/** /**
* 注册命令 * 注册命令
* *
* @param clazzs * @param clazzs 命令类
* 命令类
* @return {@link CommandMain} * @return {@link CommandMain}
*/ */
public void register(Executor... clazzs) { public void register(Executor... clazzs) {
@ -76,6 +69,8 @@ public class CommandMain implements CommandExecutor {
CommandInfo ci = CommandInfo.parse(method, clazz); CommandInfo ci = CommandInfo.parse(method, clazz);
if (ci != null) { if (ci != null) {
injectPluginCommand(ci); injectPluginCommand(ci);
// 主命令注册统一设置
ci.setMain();
Class[] params = method.getParameterTypes(); Class[] params = method.getParameterTypes();
Log.d("注册主命令 %s 参数类型: %s", ci.getName(), Log.getSimpleNames((Object[]) params)); Log.d("注册主命令 %s 参数类型: %s", ci.getName(), Log.getSimpleNames((Object[]) params));
try { try {
@ -100,8 +95,7 @@ public class CommandMain implements CommandExecutor {
/** /**
* 检查缓存并获得命令 * 检查缓存并获得命令
* *
* @param cmd * @param cmd 子命令
* 子命令
* @return 命令信息 * @return 命令信息
*/ */
private CommandInfo getByCache(String cmd) { private CommandInfo getByCache(String cmd) {