core: Allow attaching a default description to arguments

This commit is contained in:
Zach Levis 2021-01-11 23:56:42 -08:00 committed by Alexander Söderberg
parent b38c725dc5
commit 78b081ccc2
29 changed files with 323 additions and 83 deletions

View file

@ -23,6 +23,7 @@
//
package cloud.commandframework.bungee.arguments;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser;
@ -56,6 +57,7 @@ public final class PlayerArgument<C> extends CommandArgument<C, ProxiedPlayer> {
final boolean required,
final @NonNull String name,
final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionProvider,
final @NonNull ArgumentDescription defaultDescription,
final @NonNull Collection<@NonNull BiFunction<@NonNull CommandContext<C>, @NonNull Queue<@NonNull String>,
@NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors
) {
@ -66,6 +68,7 @@ public final class PlayerArgument<C> extends CommandArgument<C, ProxiedPlayer> {
"",
TypeToken.get(ProxiedPlayer.class),
suggestionProvider,
defaultDescription,
argumentPreprocessors
);
}
@ -128,6 +131,7 @@ public final class PlayerArgument<C> extends CommandArgument<C, ProxiedPlayer> {
this.isRequired(),
this.getName(),
this.getSuggestionsProvider(),
this.getDefaultDescription(),
new LinkedList<>()
);
}

View file

@ -23,6 +23,7 @@
//
package cloud.commandframework.bungee.arguments;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser;
@ -56,6 +57,7 @@ public final class ServerArgument<C> extends CommandArgument<C, ServerInfo> {
final boolean required,
final @NonNull String name,
final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription,
final @NonNull Collection<@NonNull BiFunction<@NonNull CommandContext<C>, @NonNull Queue<@NonNull String>,
@NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors
) {
@ -66,6 +68,7 @@ public final class ServerArgument<C> extends CommandArgument<C, ServerInfo> {
"",
TypeToken.get(ServerInfo.class),
suggestionsProvider,
defaultDescription,
argumentPreprocessors
);
}
@ -127,6 +130,7 @@ public final class ServerArgument<C> extends CommandArgument<C, ServerInfo> {
this.isRequired(),
this.getName(),
this.getSuggestionsProvider(),
this.getDefaultDescription(),
new LinkedList<>()
);
}