Add SWCommand.Register.description to simplify help commands
Dieser Commit ist enthalten in:
Ursprung
745ac401bb
Commit
9fe1361030
@ -250,7 +250,9 @@ public abstract class SWCommand {
|
||||
.anyMatch(s -> s.toLowerCase().startsWith(args[args.length - 1].toLowerCase()));
|
||||
if (hasTabCompletes) {
|
||||
try {
|
||||
message.sendPrefixless(subCommand.description, p);
|
||||
for (String s : subCommand.description) {
|
||||
message.sendPrefixless(s, p);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Failed to send description of registered method '" + subCommand.method + "' with description '" + subCommand.description + "'", e);
|
||||
}
|
||||
@ -263,7 +265,9 @@ public abstract class SWCommand {
|
||||
commandList.forEach(subCommand -> {
|
||||
if (subCommand.guardChecker == null || subCommand.guardChecker.guard(p, GuardCheckType.TAB_COMPLETE, new String[0], null) == GuardResult.ALLOWED) {
|
||||
try {
|
||||
message.sendPrefixless(subCommand.description, p);
|
||||
for (String s : subCommand.description) {
|
||||
message.sendPrefixless(s, p);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Failed to send description of registered method '" + subCommand.method + "' with description '" + subCommand.description + "'", e);
|
||||
}
|
||||
@ -280,7 +284,7 @@ public abstract class SWCommand {
|
||||
|
||||
boolean help() default false;
|
||||
|
||||
String description() default "";
|
||||
String[] description() default {};
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
|
@ -36,7 +36,7 @@ class SubCommand {
|
||||
|
||||
private SWCommand swCommand;
|
||||
Method method;
|
||||
String description;
|
||||
String[] description;
|
||||
String[] subCommand;
|
||||
TypeMapper<?>[] arguments;
|
||||
GuardChecker[] guards;
|
||||
@ -46,7 +46,7 @@ class SubCommand {
|
||||
Class<?> varArgType = null;
|
||||
private boolean help;
|
||||
|
||||
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) {
|
||||
this.swCommand = swCommand;
|
||||
this.method = method;
|
||||
this.help = help;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren