V
- type of the argument type.public final class RequiredArgument<V> extends Object implements Argument
Modifier and Type | Method and Description |
---|---|
static <T> @NotNull RequiredArgument<T> |
argument(@NotNull String name,
@NotNull com.mojang.brigadier.arguments.ArgumentType<T> type)
Creates a new
RequiredArgument |
<T> @NotNull com.mojang.brigadier.arguments.ArgumentType<T> |
getArgumentType()
Returns the brigadier argument type, if the argument is required.
|
@NotNull List<Argument> |
getChildren()
Returns unmodifiable copy of the children this argument is holding.
|
@NotNull String |
getName()
Returns the name of the argument.
|
@Nullable Consumer<com.mojang.brigadier.suggestion.SuggestionsBuilder> |
getSuggestionsConsumer()
Returns the
SuggestionsBuilder consumer, which is able to modify the suggestions for
this argument. |
@NotNull RequiredArgument<V> |
markShouldNotExecuteCommand() |
boolean |
shouldExecuteCommand()
Returns whether or not this argument should call the base command's execute method when the
argument ends up being the last typed argument.
|
@NotNull RequiredArgument<V> |
suggests(@Nullable Consumer<com.mojang.brigadier.suggestion.SuggestionsBuilder> suggestionsConsumer)
Sets the
SuggestionsBuilder modifications to get applied later. |
@NotNull RequiredArgument<V> |
then(Argument... other) |
@NotNull RequiredArgument<V> |
then(@NotNull Argument child)
Adds a child to this required argument.
|
@NotNull RequiredArgument<V> |
then(@NotNull Iterable<Argument> iterable) |
String |
toString() |
@NotNull public static <T> @NotNull RequiredArgument<T> argument(@NotNull @NotNull String name, @NotNull @NotNull com.mojang.brigadier.arguments.ArgumentType<T> type)
RequiredArgument
T
- type of the argument typename
- completion value you see ingametype
- type@NotNull public @NotNull String getName()
Argument
@NotNull public <T> @NotNull com.mojang.brigadier.arguments.ArgumentType<T> getArgumentType()
Argument
A literal argument does not have a dedicated argument type, and this will return null if the argument is literal.
getArgumentType
in interface Argument
T
- the type held by the argument type.@NotNull public @NotNull RequiredArgument<V> then(@NotNull @NotNull Argument child)
child
- child@NotNull public @NotNull RequiredArgument<V> then(@NotNull Argument... other)
@NotNull public @NotNull RequiredArgument<V> then(@NotNull @NotNull Iterable<Argument> iterable)
@NotNull public @NotNull RequiredArgument<V> suggests(@Nullable @Nullable Consumer<com.mojang.brigadier.suggestion.SuggestionsBuilder> suggestionsConsumer)
SuggestionsBuilder
modifications to get applied later.
We do not suggest using suggestions builder to add your suggestions. Instead, use literal arguments with combination with a required one
suggestionsConsumer
- suggestions consumer@NotNull public @NotNull RequiredArgument<V> markShouldNotExecuteCommand()
Argument.shouldExecuteCommand()
@Nullable public @Nullable Consumer<com.mojang.brigadier.suggestion.SuggestionsBuilder> getSuggestionsConsumer()
Argument
SuggestionsBuilder
consumer, which is able to modify the suggestions for
this argument. By default, this returns null.
We do not suggest using suggestions builder to add your suggestions. Instead, use literal arguments with combination with a required one
getSuggestionsConsumer
in interface Argument
public boolean shouldExecuteCommand()
Argument
shouldExecuteCommand
in interface Argument
true
if should have execute, false
otherwise@NotNull public @NotNull List<Argument> getChildren()
Argument
getChildren
in interface Argument
Copyright © 2020. All rights reserved.