core: Use the ArgumentDescription interface for descriptions

This allows minecraft-extras to provide an implementation that
uses Adventure chat components to represent the description.
This commit is contained in:
Zach Levis 2021-01-11 23:08:24 -08:00 committed by Alexander Söderberg
parent fa16fc8ef2
commit b38c725dc5
19 changed files with 903 additions and 94 deletions

View file

@ -23,9 +23,9 @@
//
package cloud.commandframework.annotations;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.Command;
import cloud.commandframework.CommandManager;
import cloud.commandframework.Description;
import cloud.commandframework.annotations.injection.ParameterInjectorRegistry;
import cloud.commandframework.annotations.injection.RawArgs;
import cloud.commandframework.annotations.parsers.MethodArgumentParser;
@ -434,7 +434,7 @@ public final class AnnotationParser<C> {
}
final String description = argumentDescriptions.getOrDefault(argument, "");
builder = builder.argument(argument, Description.of(description));
builder = builder.argument(argument, ArgumentDescription.of(description));
}
}
/* Try to find the command sender type */

View file

@ -23,8 +23,8 @@
//
package cloud.commandframework.annotations;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.CommandManager;
import cloud.commandframework.Description;
import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.flags.CommandFlag;
import cloud.commandframework.arguments.parser.ArgumentParser;
@ -60,7 +60,7 @@ final class FlagExtractor implements Function<@NonNull Method, Collection<@NonNu
final Flag flag = parameter.getAnnotation(Flag.class);
final CommandFlag.Builder<Void> builder = this.commandManager
.flagBuilder(flag.value())
.withDescription(Description.of(flag.description()))
.withDescription(ArgumentDescription.of(flag.description()))
.withAliases(flag.aliases());
if (parameter.getType().equals(boolean.class)) {
flags.add(builder.build());