diff --git a/pom.xml b/pom.xml
index e995165..a89a665 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
pw.yumc
YumCore
- 1.8.8
+ 1.8.9
${project.artifactId}
diff --git a/src/main/java/pw/yumc/YumCore/commands/CommandParse.java b/src/main/java/pw/yumc/YumCore/commands/CommandParse.java
index 5517ea2..b3128f8 100644
--- a/src/main/java/pw/yumc/YumCore/commands/CommandParse.java
+++ b/src/main/java/pw/yumc/YumCore/commands/CommandParse.java
@@ -25,10 +25,10 @@ import pw.yumc.YumCore.commands.exception.ParseException;
* @since 2016年10月5日 下午4:02:04
*/
public class CommandParse {
- private static Map allparses = new HashMap<>();
+ private static Map allParse = new HashMap<>();
private static Map primitiveMap = new HashMap<>();
private boolean isMain;
- private List parses = new LinkedList<>();
+ private List pars = new LinkedList<>();
static {
register(File.class, FileParse.class);
@@ -44,7 +44,7 @@ public class CommandParse {
primitiveMap.put("double", Double.class);
}
- public CommandParse(Class[] classes, Annotation[][] annons, boolean isMain) {
+ private CommandParse(Class[] classes, Annotation[][] annons, boolean isMain) {
this.isMain = isMain;
// 第一个参数实现了CommandSender忽略
for (int i = 1; i < classes.length; i++) {
@@ -54,22 +54,22 @@ public class CommandParse {
clazz = primitiveMap.get(clazz.getName());
}
Annotation[] annotations = annons[i];
- Parse parse = null;
- if (allparses.containsKey(clazz)) {
+ BaseParse baseParse = null;
+ if (allParse.containsKey(clazz)) {
try {
- parse = (Parse) allparses.get(clazz).newInstance();
+ baseParse = (BaseParse) allParse.get(clazz).newInstance();
} catch (InstantiationException | IllegalAccessException | NullPointerException ignored) {
}
} else {
try {
- parse = new ValueOfParse(clazz, clazz.getDeclaredMethod("valueOf", String.class));
+ baseParse = new ValueOfParse(clazz, clazz.getDeclaredMethod("valueOf", String.class));
} catch (NoSuchMethodException ignored) {
}
}
- if (parse == null) { throw new ParseException(String.format("存在无法解析的参数类型 %s", clazz.getName())); }
- this.parses.add(parse.parseAnnotation(annotations).handleAttrs());
+ if (baseParse == null) { throw new ParseException(String.format("存在无法解析的参数类型 %s", clazz.getName())); }
+ this.pars.add(baseParse.parseAnnotation(annotations).handleAttrs());
}
- Log.d("命令解析器 %s", Log.getSimpleNames(parses.toArray()));
+ Log.d("命令解析器 %s", Log.getSimpleNames(pars.toArray()));
}
public static CommandParse get(Method method) {
@@ -81,34 +81,32 @@ public class CommandParse {
*
* @param arr
* 数组
- * @param split
- * 分割符
* @return 字符串
*/
- public static String join(Object[] arr, String split) {
+ private static String join(Object[] arr) {
StringBuilder str = new StringBuilder();
for (Object s : arr) {
str.append(s.toString());
- str.append(split);
+ str.append(" ");
}
- return str.length() > split.length() ? str.toString().substring(0, str.length() - split.length()) : str.toString();
+ return str.length() > " ".length() ? str.toString().substring(0, str.length() - " ".length()) : str.toString();
}
public static void register(Class clazz, Class parse) {
- allparses.put(clazz, parse);
+ allParse.put(clazz, parse);
}
public Object[] parse(CommandSender sender, String label, String[] args) {
List