Add SWCommand.Register.Registeres #104
@ -47,8 +47,8 @@ public abstract class SWCommand {
|
||||
this.command = new Command(command, "", "/" + command, Arrays.asList(aliases)) {
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String alias, String[] args) {
|
||||
// if (commandList.stream().filter(s -> s.invoke(sender, args)).findFirst().isEmpty()) return false;
|
||||
// if (commandHelpList.stream().filter(s -> s.invoke(sender, args)).findFirst().isEmpty()) return false;
|
||||
// if (commandList.stream().filter(s -> s.invoke(sender, args)).findFirst().isPresent()) return false;
|
||||
// if (commandHelpList.stream().filter(s -> s.invoke(sender, args)).findFirst().isPresent()) return false;
|
||||
for (SubCommand subCommand : commandList) {
|
||||
if (subCommand.invoke(sender, args)) return false;
|
||||
}
|
||||
@ -109,10 +109,7 @@ public abstract class SWCommand {
|
||||
if (clazz.isEnum() && mapper == null && !SWCommandUtils.MAPPER_FUNCTIONS.containsKey(clazz.getTypeName())) {
|
||||
continue;
|
||||
}
|
||||
String name = clazz.getTypeName();
|
||||
if (mapper != null) {
|
||||
name = mapper.value();
|
||||
}
|
||||
String name = mapper != null ? mapper.value() : clazz.getTypeName();
|
||||
if (!SWCommandUtils.MAPPER_FUNCTIONS.containsKey(name) && !localTypeMapper.containsKey(name)) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "The parameter '" + parameter.toString() + "' is using an unsupported Mapper of type '" + name + "'");
|
||||
return;
|
||||
@ -126,9 +123,8 @@ public abstract class SWCommand {
|
||||
if (compare != 0) {
|
||||
return compare;
|
||||
} else {
|
||||
int i1 = o1.varArgType != null ? Integer.MAX_VALUE : o1.arguments.length;
|
||||
int i2 = o2.varArgType != null ? Integer.MAX_VALUE : o2.arguments.length;
|
||||
return Integer.compare(i1, i2);
|
||||
return Integer.compare(o1.varArgType != null ? Integer.MAX_VALUE : o1.arguments.length,
|
||||
o2.varArgType != null ? Integer.MAX_VALUE : o2.arguments.length);
|
||||
}
|
||||
});
|
||||
commandHelpList.sort(Comparator.comparingInt(o -> -o.subCommand.length));
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren