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

@ -573,7 +573,7 @@ public class Command<C> {
* @return New builder instance with the command argument inserted into the argument list * @return New builder instance with the command argument inserted into the argument list
*/ */
public <T> @NonNull Builder<C> argument(final CommandArgument.@NonNull Builder<C, T> builder) { public <T> @NonNull Builder<C> argument(final CommandArgument.@NonNull Builder<C, T> builder) {
return this.argument(builder.build(), ArgumentDescription.empty()); return this.argument(builder.build());
} }
/** /**
@ -584,7 +584,7 @@ public class Command<C> {
* @return New builder instance with the command argument inserted into the argument list * @return New builder instance with the command argument inserted into the argument list
*/ */
public <T> @NonNull Builder<C> argument(final @NonNull CommandArgument<C, T> argument) { public <T> @NonNull Builder<C> argument(final @NonNull CommandArgument<C, T> argument) {
return this.argument(argument, ArgumentDescription.empty()); return this.argument(argument, argument.getDefaultDescription());
} }
/** /**

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments; package cloud.commandframework.arguments;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.Command; import cloud.commandframework.Command;
import cloud.commandframework.CommandManager; import cloud.commandframework.CommandManager;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
@ -99,6 +100,12 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
*/ */
private final Collection<BiFunction<@NonNull CommandContext<C>, private final Collection<BiFunction<@NonNull CommandContext<C>,
@NonNull Queue<@NonNull String>, @NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors; @NonNull Queue<@NonNull String>, @NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors;
/**
* A description that will be used when registering this argument if no override is provided.
*/
private final ArgumentDescription defaultDescription;
/** /**
* Whether or not the argument has been used before * Whether or not the argument has been used before
*/ */
@ -106,6 +113,46 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
private Command<C> owningCommand; private Command<C> owningCommand;
/**
* Construct a new command argument
*
* @param required Whether or not the argument is required
* @param name The argument name
* @param parser The argument parser
* @param defaultValue Default value used when no value is provided by the command sender
* @param valueType Type produced by the parser
* @param suggestionsProvider Suggestions provider
* @param defaultDescription Default description to use when registering
* @param argumentPreprocessors Argument preprocessors
* @since 1.4.0
*/
public CommandArgument(
final boolean required,
final @NonNull String name,
final @NonNull ArgumentParser<C, T> parser,
final @NonNull String defaultValue,
final @NonNull TypeToken<T> valueType,
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
) {
this.required = required;
this.name = Objects.requireNonNull(name, "Name may not be null");
if (!NAME_PATTERN.asPredicate().test(name)) {
throw new IllegalArgumentException("Name must be alphanumeric");
}
this.parser = Objects.requireNonNull(parser, "Parser may not be null");
this.defaultValue = defaultValue;
this.valueType = valueType;
this.suggestionsProvider = suggestionsProvider == null
? buildDefaultSuggestionsProvider(this)
: suggestionsProvider;
this.defaultDescription = Objects.requireNonNull(defaultDescription, "Default description may not be null");
this.argumentPreprocessors = new LinkedList<>(argumentPreprocessors);
this.key = SimpleCloudKey.of(this.name, this.valueType);
}
/** /**
* Construct a new command argument * Construct a new command argument
* *
@ -127,19 +174,16 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
final @NonNull Collection<@NonNull BiFunction<@NonNull CommandContext<C>, @NonNull Queue<@NonNull String>, final @NonNull Collection<@NonNull BiFunction<@NonNull CommandContext<C>, @NonNull Queue<@NonNull String>,
@NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors @NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors
) { ) {
this.required = required; this(
this.name = Objects.requireNonNull(name, "Name may not be null"); required,
if (!NAME_PATTERN.asPredicate().test(name)) { name,
throw new IllegalArgumentException("Name must be alphanumeric"); parser,
} defaultValue,
this.parser = Objects.requireNonNull(parser, "Parser may not be null"); valueType,
this.defaultValue = defaultValue; suggestionsProvider,
this.valueType = valueType; ArgumentDescription.empty(),
this.suggestionsProvider = suggestionsProvider == null argumentPreprocessors
? buildDefaultSuggestionsProvider(this) );
: suggestionsProvider;
this.argumentPreprocessors = new LinkedList<>(argumentPreprocessors);
this.key = SimpleCloudKey.of(this.name, this.valueType);
} }
/** /**
@ -163,6 +207,30 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
this(required, name, parser, defaultValue, valueType, suggestionsProvider, Collections.emptyList()); this(required, name, parser, defaultValue, valueType, suggestionsProvider, Collections.emptyList());
} }
/**
* Construct a new command argument
*
* @param required Whether or not the argument is required
* @param name The argument name
* @param parser The argument parser
* @param defaultValue Default value used when no value is provided by the command sender
* @param valueType Type produced by the parser
* @param suggestionsProvider Suggestions provider
* @param defaultDescription Default description to use when registering
* @since 1.4.0
*/
public CommandArgument(
final boolean required,
final @NonNull String name,
final @NonNull ArgumentParser<C, T> parser,
final @NonNull String defaultValue,
final @NonNull TypeToken<T> valueType,
final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) {
this(required, name, parser, defaultValue, valueType, suggestionsProvider, defaultDescription, Collections.emptyList());
}
/** /**
* Construct a new command argument * Construct a new command argument
* *
@ -185,6 +253,31 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
this(required, name, parser, defaultValue, TypeToken.get(valueType), suggestionsProvider); this(required, name, parser, defaultValue, TypeToken.get(valueType), suggestionsProvider);
} }
/**
* Construct a new command argument
*
* @param required Whether or not the argument is required
* @param name The argument name
* @param parser The argument parser
* @param defaultValue Default value used when no value is provided by the command sender
* @param valueType Type produced by the parser
* @param suggestionsProvider Suggestions provider
* @param defaultDescription Default description to use when registering
* @since 1.4.0
*/
public CommandArgument(
final boolean required,
final @NonNull String name,
final @NonNull ArgumentParser<C, T> parser,
final @NonNull String defaultValue,
final @NonNull Class<T> valueType,
final @Nullable BiFunction<@NonNull CommandContext<C>,
@NonNull String, @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) {
this(required, name, parser, defaultValue, TypeToken.get(valueType), suggestionsProvider, defaultDescription);
}
/** /**
* Construct a new command argument * Construct a new command argument
* *
@ -351,6 +444,15 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
return this.suggestionsProvider; return this.suggestionsProvider;
} }
/**
* Get the default description to use when registering and no other is provided.
*
* @return the default description
*/
public final @NonNull ArgumentDescription getDefaultDescription() {
return this.defaultDescription;
}
@Override @Override
public final boolean equals(final Object o) { public final boolean equals(final Object o) {
if (this == o) { if (this == o) {
@ -429,6 +531,8 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
} else { } else {
builder = builder.asOptionalWithDefault(this.defaultValue); builder = builder.asOptionalWithDefault(this.defaultValue);
} }
builder = builder.withDefaultDescription(this.defaultDescription);
return builder.build(); return builder.build();
} }
@ -465,6 +569,7 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
private ArgumentParser<C, T> parser; private ArgumentParser<C, T> parser;
private String defaultValue = ""; private String defaultValue = "";
private BiFunction<@NonNull CommandContext<C>, @NonNull String, @NonNull List<String>> suggestionsProvider; private BiFunction<@NonNull CommandContext<C>, @NonNull String, @NonNull List<String>> suggestionsProvider;
private @NonNull ArgumentDescription defaultDescription = ArgumentDescription.empty();
private final Collection<BiFunction<@NonNull CommandContext<C>, private final Collection<BiFunction<@NonNull CommandContext<C>,
@NonNull String, @NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors = new LinkedList<>(); @NonNull String, @NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors = new LinkedList<>();
@ -565,6 +670,22 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
return this; return this;
} }
/**
* Set the default description to be used for this argument.
*
* <p>The default description is used when no other description is provided for a certain argument.</p>
*
* @param defaultDescription The default description
* @return Builder instance
* @since 1.4.0
*/
public @NonNull Builder<@NonNull C, @NonNull T> withDefaultDescription(
final @NonNull ArgumentDescription defaultDescription
) {
this.defaultDescription = Objects.requireNonNull(defaultDescription, "Default description may not be null");
return this;
}
/** /**
* Construct a command argument from the builder settings * Construct a command argument from the builder settings
* *
@ -588,7 +709,8 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
this.parser, this.parser,
this.defaultValue, this.defaultValue,
this.valueType, this.valueType,
this.suggestionsProvider this.suggestionsProvider,
this.defaultDescription
); );
} }
@ -613,6 +735,10 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
return this.suggestionsProvider; return this.suggestionsProvider;
} }
protected final @NonNull ArgumentDescription getDefaultDescription() {
return this.defaultDescription;
}
} }
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -50,9 +51,10 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
final boolean liberal, final boolean liberal,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription description
) { ) {
super(required, name, new BooleanParser<>(liberal), defaultValue, Boolean.class, suggestionsProvider); super(required, name, new BooleanParser<>(liberal), defaultValue, Boolean.class, suggestionsProvider, description);
this.liberal = liberal; this.liberal = liberal;
} }
@ -110,7 +112,7 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
* @return Liberal boolean * @return Liberal boolean
*/ */
public boolean isLiberal() { public boolean isLiberal() {
return liberal; return this.liberal;
} }
public static final class Builder<C> extends CommandArgument.Builder<C, Boolean> { public static final class Builder<C> extends CommandArgument.Builder<C, Boolean> {
@ -144,7 +146,8 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
this.getName(), this.getName(),
this.liberal, this.liberal,
this.getDefaultValue(), this.getDefaultValue(),
this.getSuggestionsProvider() this.getSuggestionsProvider(),
this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -49,9 +50,10 @@ public final class ByteArgument<C> extends CommandArgument<C, Byte> {
final byte max, final byte max,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new ByteParser<>(min, max), defaultValue, Byte.class, suggestionsProvider); super(required, name, new ByteParser<>(min, max), defaultValue, Byte.class, suggestionsProvider, defaultDescription);
this.min = min; this.min = min;
this.max = max; this.max = max;
} }
@ -161,7 +163,7 @@ public final class ByteArgument<C> extends CommandArgument<C, Byte> {
@Override @Override
public @NonNull ByteArgument<C> build() { public @NonNull ByteArgument<C> build() {
return new ByteArgument<>(this.isRequired(), this.getName(), this.min, this.max, return new ByteArgument<>(this.isRequired(), this.getName(), this.min, this.max,
this.getDefaultValue(), this.getSuggestionsProvider() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -46,9 +47,10 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, final @Nullable BiFunction<@NonNull CommandContext<C>,
@NonNull String, @NonNull List<@NonNull String>> suggestionsProvider @NonNull String, @NonNull List<@NonNull String>> suggestionsProvider,
) { final @NonNull ArgumentDescription defaultDescription
super(required, name, new CharacterParser<>(), defaultValue, Character.class, suggestionsProvider); ) {
super(required, name, new CharacterParser<>(), defaultValue, Character.class, suggestionsProvider, defaultDescription);
} }
/** /**
@ -114,7 +116,7 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
@Override @Override
public @NonNull CharArgument<C> build() { public @NonNull CharArgument<C> build() {
return new CharArgument<>(this.isRequired(), this.getName(), return new CharArgument<>(this.isRequired(), this.getName(),
this.getDefaultValue(), this.getSuggestionsProvider() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -49,9 +50,10 @@ public final class DoubleArgument<C> extends CommandArgument<C, Double> {
final double max, final double max,
final String defaultValue, final String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new DoubleParser<>(min, max), defaultValue, Double.class, suggestionsProvider); super(required, name, new DoubleParser<>(min, max), defaultValue, Double.class, suggestionsProvider, defaultDescription);
this.min = min; this.min = min;
this.max = max; this.max = max;
} }
@ -161,7 +163,7 @@ public final class DoubleArgument<C> extends CommandArgument<C, Double> {
@Override @Override
public @NonNull DoubleArgument<C> build() { public @NonNull DoubleArgument<C> build() {
return new DoubleArgument<>(this.isRequired(), this.getName(), this.min, this.max, return new DoubleArgument<>(this.isRequired(), this.getName(), this.min, this.max,
this.getDefaultValue(), this.getSuggestionsProvider() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -55,9 +56,10 @@ public class EnumArgument<C, E extends Enum<E>> extends CommandArgument<C, E> {
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new EnumParser<>(enumClass), defaultValue, enumClass, suggestionsProvider); super(required, name, new EnumParser<>(enumClass), defaultValue, enumClass, suggestionsProvider, defaultDescription);
} }
/** /**
@ -139,7 +141,7 @@ public class EnumArgument<C, E extends Enum<E>> extends CommandArgument<C, E> {
@Override @Override
public @NonNull CommandArgument<C, E> build() { public @NonNull CommandArgument<C, E> build() {
return new EnumArgument<>(this.enumClass, this.isRequired(), this.getName(), return new EnumArgument<>(this.enumClass, this.isRequired(), this.getName(),
this.getDefaultValue(), this.getSuggestionsProvider() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -49,9 +50,10 @@ public final class FloatArgument<C> extends CommandArgument<C, Float> {
final float max, final float max,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, final @Nullable BiFunction<@NonNull CommandContext<C>,
@NonNull String, @NonNull List<@NonNull String>> suggestionsProvider @NonNull String, @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new FloatParser<>(min, max), defaultValue, Float.class, suggestionsProvider); super(required, name, new FloatParser<>(min, max), defaultValue, Float.class, suggestionsProvider, defaultDescription);
this.min = min; this.min = min;
this.max = max; this.max = max;
} }
@ -161,7 +163,7 @@ public final class FloatArgument<C> extends CommandArgument<C, Float> {
@Override @Override
public @NonNull FloatArgument<C> build() { public @NonNull FloatArgument<C> build() {
return new FloatArgument<>(this.isRequired(), this.getName(), this.min, this.max, return new FloatArgument<>(this.isRequired(), this.getName(), this.min, this.max,
this.getDefaultValue(), this.getSuggestionsProvider() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -56,9 +57,10 @@ public final class IntegerArgument<C> extends CommandArgument<C, Integer> {
final int max, final int max,
final String defaultValue, final String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new IntegerParser<>(min, max), defaultValue, Integer.class, suggestionsProvider); super(required, name, new IntegerParser<>(min, max), defaultValue, Integer.class, suggestionsProvider, defaultDescription);
this.min = min; this.min = min;
this.max = max; this.max = max;
} }
@ -168,7 +170,7 @@ public final class IntegerArgument<C> extends CommandArgument<C, Integer> {
@Override @Override
public @NonNull IntegerArgument<C> build() { public @NonNull IntegerArgument<C> build() {
return new IntegerArgument<>(this.isRequired(), this.getName(), this.min, this.max, return new IntegerArgument<>(this.isRequired(), this.getName(), this.min, this.max,
this.getDefaultValue(), this.getSuggestionsProvider() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -49,9 +50,10 @@ public final class LongArgument<C> extends CommandArgument<C, Long> {
final long max, final long max,
final String defaultValue, final String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new LongParser<>(min, max), defaultValue, Long.class, suggestionsProvider); super(required, name, new LongParser<>(min, max), defaultValue, Long.class, suggestionsProvider, defaultDescription);
this.min = min; this.min = min;
this.max = max; this.max = max;
} }
@ -161,7 +163,7 @@ public final class LongArgument<C> extends CommandArgument<C, Long> {
@Override @Override
public @NonNull LongArgument<C> build() { public @NonNull LongArgument<C> build() {
return new LongArgument<>(this.isRequired(), this.getName(), this.min, return new LongArgument<>(this.isRequired(), this.getName(), this.min,
this.max, this.getDefaultValue(), this.getSuggestionsProvider() this.max, this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -49,9 +50,10 @@ public final class ShortArgument<C> extends CommandArgument<C, Short> {
final short max, final short max,
final String defaultValue, final String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<String>> suggestionsProvider @NonNull List<String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new ShortParser<>(min, max), defaultValue, Short.class, suggestionsProvider); super(required, name, new ShortParser<>(min, max), defaultValue, Short.class, suggestionsProvider, defaultDescription);
this.min = min; this.min = min;
this.max = max; this.max = max;
} }
@ -161,7 +163,7 @@ public final class ShortArgument<C> extends CommandArgument<C, Short> {
@Override @Override
public @NonNull ShortArgument<C> build() { public @NonNull ShortArgument<C> build() {
return new ShortArgument<>(this.isRequired(), this.getName(), this.min, this.max, return new ShortArgument<>(this.isRequired(), this.getName(), this.min, this.max,
this.getDefaultValue(), this.getSuggestionsProvider() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -56,10 +57,11 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
final @NonNull StringMode stringMode, final @NonNull StringMode stringMode,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @NonNull BiFunction<@NonNull CommandContext<C>, @NonNull String, final @NonNull BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new StringParser<>(stringMode, suggestionsProvider), super(required, name, new StringParser<>(stringMode, suggestionsProvider),
defaultValue, String.class, suggestionsProvider defaultValue, String.class, suggestionsProvider, defaultDescription
); );
this.stringMode = stringMode; this.stringMode = stringMode;
} }
@ -265,7 +267,7 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
@Override @Override
public @NonNull StringArgument<C> build() { public @NonNull StringArgument<C> build() {
return new StringArgument<>(this.isRequired(), this.getName(), this.stringMode, return new StringArgument<>(this.isRequired(), this.getName(), this.stringMode,
this.getDefaultValue(), this.suggestionsProvider this.getDefaultValue(), this.suggestionsProvider, this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -47,7 +48,8 @@ public final class StringArrayArgument<C> extends CommandArgument<C, String[]> {
private StringArrayArgument( private StringArrayArgument(
final boolean required, final boolean required,
final @NonNull String name, final @NonNull String name,
final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionsProvider final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super( super(
required, required,
@ -55,7 +57,8 @@ public final class StringArrayArgument<C> extends CommandArgument<C, String[]> {
new StringArrayParser<>(), new StringArrayParser<>(),
"", "",
TypeToken.get(String[].class), TypeToken.get(String[].class),
suggestionsProvider suggestionsProvider,
defaultDescription
); );
} }
@ -74,7 +77,8 @@ public final class StringArrayArgument<C> extends CommandArgument<C, String[]> {
return new StringArrayArgument<>( return new StringArrayArgument<>(
true, true,
name, name,
suggestionsProvider suggestionsProvider,
ArgumentDescription.empty()
); );
} }
@ -93,7 +97,8 @@ public final class StringArrayArgument<C> extends CommandArgument<C, String[]> {
return new StringArrayArgument<>( return new StringArrayArgument<>(
false, false,
name, name,
suggestionsProvider suggestionsProvider,
ArgumentDescription.empty()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.arguments.standard; package cloud.commandframework.arguments.standard;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -47,9 +48,10 @@ public final class UUIDArgument<C> extends CommandArgument<C, UUID> {
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, final @Nullable BiFunction<@NonNull CommandContext<C>,
@NonNull String, @NonNull List<@NonNull String>> suggestionsProvider @NonNull String, @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new UUIDParser<>(), defaultValue, UUID.class, suggestionsProvider); super(required, name, new UUIDParser<>(), defaultValue, UUID.class, suggestionsProvider, defaultDescription);
} }
/** /**
@ -114,7 +116,13 @@ public final class UUIDArgument<C> extends CommandArgument<C, UUID> {
*/ */
@Override @Override
public @NonNull UUIDArgument<C> build() { public @NonNull UUIDArgument<C> build() {
return new UUIDArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(), this.getSuggestionsProvider()); return new UUIDArgument<>(
this.isRequired(),
this.getName(),
this.getDefaultValue(),
this.getSuggestionsProvider(),
this.getDefaultDescription()
);
} }
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers; package cloud.commandframework.bukkit.parsers;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -53,9 +54,10 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
) { final @NonNull ArgumentDescription defaultDescription
super(required, name, new EnchantmentParser<>(), defaultValue, Enchantment.class, suggestionsProvider); ) {
super(required, name, new EnchantmentParser<>(), defaultValue, Enchantment.class, suggestionsProvider, defaultDescription);
} }
/** /**
@ -118,7 +120,8 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
this.isRequired(), this.isRequired(),
this.getName(), this.getName(),
this.getDefaultValue(), this.getDefaultValue(),
this.getSuggestionsProvider() this.getSuggestionsProvider(),
this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers; package cloud.commandframework.bukkit.parsers;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -52,8 +53,9 @@ public class MaterialArgument<C> extends CommandArgument<C, Material> {
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
) { final @NonNull ArgumentDescription defaultDescription
) {
super(required, name, new MaterialParser<>(), defaultValue, Material.class, suggestionsProvider); super(required, name, new MaterialParser<>(), defaultValue, Material.class, suggestionsProvider);
} }
@ -117,7 +119,8 @@ public class MaterialArgument<C> extends CommandArgument<C, Material> {
this.isRequired(), this.isRequired(),
this.getName(), this.getName(),
this.getDefaultValue(), this.getDefaultValue(),
this.getSuggestionsProvider() this.getSuggestionsProvider(),
this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers; package cloud.commandframework.bukkit.parsers;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -58,9 +59,18 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new OfflinePlayerParser<>(), defaultValue, OfflinePlayer.class, suggestionsProvider); super(
required,
name,
new OfflinePlayerParser<>(),
defaultValue,
OfflinePlayer.class,
suggestionsProvider,
defaultDescription
);
} }
/** /**
@ -126,7 +136,7 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
@Override @Override
public @NonNull OfflinePlayerArgument<C> build() { public @NonNull OfflinePlayerArgument<C> build() {
return new OfflinePlayerArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(), return new OfflinePlayerArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(),
this.getSuggestionsProvider() this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers; package cloud.commandframework.bukkit.parsers;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -54,9 +55,10 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new PlayerParser<>(), defaultValue, Player.class, suggestionsProvider); super(required, name, new PlayerParser<>(), defaultValue, Player.class, suggestionsProvider, defaultDescription);
} }
/** /**
@ -121,7 +123,13 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
*/ */
@Override @Override
public @NonNull PlayerArgument<C> build() { public @NonNull PlayerArgument<C> build() {
return new PlayerArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(), this.getSuggestionsProvider()); return new PlayerArgument<>(
this.isRequired(),
this.getName(),
this.getDefaultValue(),
this.getSuggestionsProvider(),
this.getDefaultDescription()
);
} }
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers; package cloud.commandframework.bukkit.parsers;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -52,9 +53,10 @@ public class WorldArgument<C> extends CommandArgument<C, World> {
final boolean required, final boolean required,
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionsProvider final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new WorldParser<>(), defaultValue, World.class, suggestionsProvider); super(required, name, new WorldParser<>(), defaultValue, World.class, suggestionsProvider, defaultDescription);
} }
/** /**
@ -114,7 +116,13 @@ public class WorldArgument<C> extends CommandArgument<C, World> {
@Override @Override
public @NonNull CommandArgument<C, World> build() { public @NonNull CommandArgument<C, World> build() {
return new WorldArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(), this.getSuggestionsProvider()); return new WorldArgument<>(
this.isRequired(),
this.getName(),
this.getDefaultValue(),
this.getSuggestionsProvider(),
this.getDefaultDescription()
);
} }
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers.location; package cloud.commandframework.bukkit.parsers.location;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -57,6 +58,7 @@ public final class Location2DArgument<C> extends CommandArgument<C, Location2D>
final boolean required, final boolean required,
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @NonNull ArgumentDescription defaultDescription,
final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionsProvider, final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionsProvider,
final @NonNull Collection<@NonNull BiFunction<@NonNull CommandContext<C>, final @NonNull Collection<@NonNull BiFunction<@NonNull CommandContext<C>,
@NonNull Queue<@NonNull String>, @NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors @NonNull Queue<@NonNull String>, @NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors
@ -68,6 +70,7 @@ public final class Location2DArgument<C> extends CommandArgument<C, Location2D>
defaultValue, defaultValue,
TypeToken.get(Location2D.class), TypeToken.get(Location2D.class),
suggestionsProvider, suggestionsProvider,
defaultDescription,
argumentPreprocessors argumentPreprocessors
); );
} }
@ -133,6 +136,7 @@ public final class Location2DArgument<C> extends CommandArgument<C, Location2D>
this.isRequired(), this.isRequired(),
this.getName(), this.getName(),
this.getDefaultValue(), this.getDefaultValue(),
this.getDefaultDescription(),
this.getSuggestionsProvider(), this.getSuggestionsProvider(),
new LinkedList<>() new LinkedList<>()
); );

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers.location; package cloud.commandframework.bukkit.parsers.location;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -63,6 +64,7 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionsProvider, final @Nullable BiFunction<CommandContext<C>, String, List<String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription,
final @NonNull Collection<@NonNull BiFunction<@NonNull CommandContext<C>, final @NonNull Collection<@NonNull BiFunction<@NonNull CommandContext<C>,
@NonNull Queue<@NonNull String>, @NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors @NonNull Queue<@NonNull String>, @NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors
) { ) {
@ -73,6 +75,7 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
defaultValue, defaultValue,
TypeToken.get(Location.class), TypeToken.get(Location.class),
suggestionsProvider, suggestionsProvider,
defaultDescription,
argumentPreprocessors argumentPreprocessors
); );
} }
@ -139,6 +142,7 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
this.getName(), this.getName(),
this.getDefaultValue(), this.getDefaultValue(),
this.getSuggestionsProvider(), this.getSuggestionsProvider(),
this.getDefaultDescription(),
new LinkedList<>() new LinkedList<>()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers.selector; package cloud.commandframework.bukkit.parsers.selector;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -47,10 +48,11 @@ public final class MultipleEntitySelectorArgument<C> extends CommandArgument<C,
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new MultipleEntitySelectorParser<>(), defaultValue, MultipleEntitySelector.class, super(required, name, new MultipleEntitySelectorParser<>(), defaultValue, MultipleEntitySelector.class,
suggestionsProvider suggestionsProvider, defaultDescription
); );
} }
@ -117,7 +119,7 @@ public final class MultipleEntitySelectorArgument<C> extends CommandArgument<C,
@Override @Override
public @NonNull MultipleEntitySelectorArgument<C> build() { public @NonNull MultipleEntitySelectorArgument<C> build() {
return new MultipleEntitySelectorArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(), return new MultipleEntitySelectorArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(),
this.getSuggestionsProvider() this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers.selector; package cloud.commandframework.bukkit.parsers.selector;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -51,10 +52,11 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new MultiplePlayerSelectorParser<>(), defaultValue, MultiplePlayerSelector.class, super(required, name, new MultiplePlayerSelectorParser<>(), defaultValue, MultiplePlayerSelector.class,
suggestionsProvider suggestionsProvider, defaultDescription
); );
} }
@ -121,7 +123,7 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
@Override @Override
public @NonNull MultiplePlayerSelectorArgument<C> build() { public @NonNull MultiplePlayerSelectorArgument<C> build() {
return new MultiplePlayerSelectorArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(), return new MultiplePlayerSelectorArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(),
this.getSuggestionsProvider() this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers.selector; package cloud.commandframework.bukkit.parsers.selector;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -47,9 +48,18 @@ public final class SingleEntitySelectorArgument<C> extends CommandArgument<C, Si
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new SingleEntitySelectorParser<>(), defaultValue, SingleEntitySelector.class, suggestionsProvider); super(
required,
name,
new SingleEntitySelectorParser<>(),
defaultValue,
SingleEntitySelector.class,
suggestionsProvider,
defaultDescription
);
} }
/** /**
@ -115,7 +125,7 @@ public final class SingleEntitySelectorArgument<C> extends CommandArgument<C, Si
@Override @Override
public @NonNull SingleEntitySelectorArgument<C> build() { public @NonNull SingleEntitySelectorArgument<C> build() {
return new SingleEntitySelectorArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(), return new SingleEntitySelectorArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(),
this.getSuggestionsProvider() this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

@ -23,6 +23,7 @@
// //
package cloud.commandframework.bukkit.parsers.selector; package cloud.commandframework.bukkit.parsers.selector;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
@ -51,9 +52,18 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
final @NonNull String name, final @NonNull String name,
final @NonNull String defaultValue, final @NonNull String defaultValue,
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) { ) {
super(required, name, new SinglePlayerSelectorParser<>(), defaultValue, SinglePlayerSelector.class, suggestionsProvider); super(
required,
name,
new SinglePlayerSelectorParser<>(),
defaultValue,
SinglePlayerSelector.class,
suggestionsProvider,
defaultDescription
);
} }
/** /**
@ -119,7 +129,7 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
@Override @Override
public @NonNull SinglePlayerSelectorArgument<C> build() { public @NonNull SinglePlayerSelectorArgument<C> build() {
return new SinglePlayerSelectorArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(), return new SinglePlayerSelectorArgument<>(this.isRequired(), this.getName(), this.getDefaultValue(),
this.getSuggestionsProvider() this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }

View file

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

View file

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

View file

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

View file

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