Dieser Commit ist enthalten in:
Ursprung
4e576fe966
Commit
d6cf8477f9
@ -78,6 +78,7 @@ public abstract class SWCommand {
|
|||||||
}
|
}
|
||||||
String string = args[args.length - 1].toLowerCase();
|
String string = args[args.length - 1].toLowerCase();
|
||||||
return commandList.stream()
|
return commandList.stream()
|
||||||
|
.filter(s -> !s.noTabComplete)
|
||||||
.map(s -> s.tabComplete(sender, args))
|
.map(s -> s.tabComplete(sender, args))
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
@ -118,7 +119,7 @@ public abstract class SWCommand {
|
|||||||
Bukkit.getLogger().log(Level.WARNING, () -> "The method '" + method.toString() + "' is lacking the varArgs parameters of type '" + String.class.getTypeName() + "' as last Argument");
|
Bukkit.getLogger().log(Level.WARNING, () -> "The method '" + method.toString() + "' is lacking the varArgs parameters of type '" + String.class.getTypeName() + "' as last Argument");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
commandHelpList.add(new SubCommand(this, method, anno.value(), new HashMap<>(), localGuardChecker, true, null));
|
commandHelpList.add(new SubCommand(this, method, anno.value(), new HashMap<>(), localGuardChecker, true, null, anno.noTabComplete()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (Method method : methods) {
|
for (Method method : methods) {
|
||||||
@ -140,7 +141,7 @@ public abstract class SWCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
commandList.add(new SubCommand(this, method, anno.value(), localTypeMapper, localGuardChecker, false, anno.description()));
|
commandList.add(new SubCommand(this, method, anno.value(), localTypeMapper, localGuardChecker, false, anno.description(), anno.noTabComplete()));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.commandList.sort((o1, o2) -> {
|
this.commandList.sort((o1, o2) -> {
|
||||||
@ -287,6 +288,8 @@ public abstract class SWCommand {
|
|||||||
|
|
||||||
String[] description() default {};
|
String[] description() default {};
|
||||||
|
|
||||||
|
boolean noTabComplete() default false;
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target({ElementType.METHOD})
|
@Target({ElementType.METHOD})
|
||||||
@interface Registeres {
|
@interface Registeres {
|
||||||
|
@ -45,12 +45,14 @@ class SubCommand {
|
|||||||
GuardChecker guardChecker;
|
GuardChecker guardChecker;
|
||||||
Class<?> varArgType = null;
|
Class<?> varArgType = null;
|
||||||
private boolean help;
|
private boolean help;
|
||||||
|
boolean noTabComplete = false;
|
||||||
|
|
||||||
SubCommand(SWCommand swCommand, Method method, String[] subCommand, Map<String, TypeMapper<?>> localTypeMapper, Map<String, GuardChecker> localGuardChecker, boolean help, String[] description) {
|
SubCommand(SWCommand swCommand, Method method, String[] subCommand, Map<String, TypeMapper<?>> localTypeMapper, Map<String, GuardChecker> localGuardChecker, boolean help, String[] description, boolean noTabComplete) {
|
||||||
this.swCommand = swCommand;
|
this.swCommand = swCommand;
|
||||||
this.method = method;
|
this.method = method;
|
||||||
this.help = help;
|
this.help = help;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
this.noTabComplete = noTabComplete;
|
||||||
|
|
||||||
Parameter[] parameters = method.getParameters();
|
Parameter[] parameters = method.getParameters();
|
||||||
commandSenderPredicate = sender -> parameters[0].getType().isAssignableFrom(sender.getClass());
|
commandSenderPredicate = sender -> parameters[0].getType().isAssignableFrom(sender.getClass());
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren