SteamWar/SpigotCore
Archiviert
13
0

CommandFramework3 #94

Manuell gemergt
Zeanon hat 71 Commits von CommandFramework3 nach master 2021-03-30 21:15:40 +02:00 zusammengeführt
Nur Änderungen aus Commit ae26f2837d werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -73,15 +73,15 @@ public abstract class SWCommand {
}
});
Set<Method> commandMethods = new HashSet<>();
for (Method method : getClass().getDeclaredMethods()) {
addMapper(method);
addCommand(method, commandMethods);
}
for (Method method : getClass().getDeclaredMethods()) {
addCommand(method);
}
commandMethods.forEach(method -> commandSet.add(new SubCommand(this, method)));
}
private void addCommand(Method method) {
private void addCommand(Method method, Set<Method> commandMethods) {
Register register = method.getDeclaredAnnotation(Register.class);
Mapper methodMapper = method.getDeclaredAnnotation(Mapper.class);
if (register == null || methodMapper != null) {
@ -101,17 +101,17 @@ public abstract class SWCommand {
if (parameter.isVarArgs() && i == parameters.length - 1) {
clazz = parameter.getType().getComponentType();
}
if (clazz.isEnum()) {
Mapper mapper = parameter.getAnnotation(Mapper.class);
if (clazz.isEnum() && mapper == null) {
continue;
}
String name = clazz.getTypeName();
Mapper mapper = parameter.getAnnotation(Mapper.class);
if (mapper != null) {
name = mapper.value();
}
if (!SWCommandUtils.MAPPER_FUNCTIONS.containsKey(name)) return;
}
commandSet.add(new SubCommand(this, method));
commandMethods.add(method);
}
private void addMapper(Method method) {