Interface RawArgument<T>
- Type Parameters:
T
- - The object type of the command argument.
- All Superinterfaces:
DataSerializable
The interface is designed to simplify the creation of
You can use it to create arguments for this commands, just like you do for
Unlike
However, adding autocomplete to RawSettings commands and then checking the arguments is very time-consuming.
Using this interface together with the
RawSettings
type commands.You can use it to create arguments for this commands, just like you do for
Command.Parameterized
commands.Unlike
Command.Parameterized
commands, RawSettings
commands have no problem with the availability of game objects, which are registered after the commands are registered.However, adding autocomplete to RawSettings commands and then checking the arguments is very time-consuming.
Using this interface together with the
RawCommand
interface saves you from having to do such time-consuming work.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> RawArgument.Builder<T>
builder()
Specifies the argument type.
See theCommandTreeNodeTypes
class for available variants.
The specified type defines what the player can enter as an argument.
This is not controlled by the plugin, but the player will see an error message if the value type is not appropriate.Class<?>
getClazz()
Class of argument.int
Argument number.Object[]
Path to find the message that there is no matching command argument in the localization configuration.Converts a string argument to a specified class.getResult
(Class<T> clazz, CommandCause cause, String[] args) Converts a string argument to a specified class.Optional<?>
getResultUnknownType
(CommandCause cause, String[] args) Retrieves an object from the command's argument string without converting it to a specific type.The identifier of the argument in the argument tree.
It is also displayed to the player above the input line as a hint.getVariants
(CommandCause cause, String[] args) Autocomplete variants.boolean
hasPermission
(CommandCause cause) boolean
Whether the argument is optional.boolean
Is the argument optional for non-players.static <T,
C extends CommandTreeNode<C>>
RawArgument<T>of
(@NotNull Class<T> clazz, CommandTreeNode.Argument<C> argumentNodeType, @NotNull RawCompleterSupplier<Stream<String>> plainVariants, @NotNull RawResultSupplier<T> result, @NotNull String key, boolean optional, boolean optionalForConsole, int cursor, String permission, @NotNull Object... localesPath) static <T> RawArgument<T>
of
(Class<T> clazz, Stream<String> variants, RawResultSupplier<T> result, boolean optional, boolean optionalForConsole, int cursor, String permission, Object... localesPath) Deprecated.static <T> RawArgument<T>
of
(Class<T> clazz, RawCompleterSupplier<Stream<String>> variants, RawResultSupplier<T> result, boolean optional, boolean optionalForConsole, int cursor, Object... localesPath) Deprecated.static <T> RawArgument<T>
of
(Class<T> clazz, RawCompleterSupplier<Stream<String>> variants, RawResultSupplier<T> result, boolean optional, boolean optionalForConsole, int cursor, String permission, Object... localesPath) Deprecated.Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainer
-
Method Details
-
builder
-
of
static <T,C extends CommandTreeNode<C>> RawArgument<T> of(@NotNull @NotNull Class<T> clazz, CommandTreeNode.Argument<C> argumentNodeType, @NotNull @NotNull RawCompleterSupplier<Stream<String>> plainVariants, @NotNull @NotNull RawResultSupplier<T> result, @NotNull @NotNull String key, boolean optional, boolean optionalForConsole, int cursor, String permission, @NotNull @NotNull Object... localesPath) -
of
@Deprecated static <T> RawArgument<T> of(Class<T> clazz, RawCompleterSupplier<Stream<String>> variants, RawResultSupplier<T> result, boolean optional, boolean optionalForConsole, int cursor, Object... localesPath) Deprecated. -
of
@Deprecated static <T> RawArgument<T> of(Class<T> clazz, RawCompleterSupplier<Stream<String>> variants, RawResultSupplier<T> result, boolean optional, boolean optionalForConsole, int cursor, String permission, Object... localesPath) Deprecated. -
of
@Deprecated static <T> RawArgument<T> of(Class<T> clazz, Stream<String> variants, RawResultSupplier<T> result, boolean optional, boolean optionalForConsole, int cursor, String permission, Object... localesPath) Deprecated. -
getArgumentType
CommandTreeNode.Argument<?> getArgumentType()Specifies the argument type.
See theCommandTreeNodeTypes
class for available variants.
The specified type defines what the player can enter as an argument.
This is not controlled by the plugin, but the player will see an error message if the value type is not appropriate. -
getTreeKey
String getTreeKey()The identifier of the argument in the argument tree.
It is also displayed to the player above the input line as a hint. -
getVariants
Autocomplete variants. -
getResult
Converts a string argument to a specified class. If the specified class does not match the argument class, the return will be empty. -
getResult
Converts a string argument to a specified class. If the specified class does not match the argument class, the return will be empty. -
getResultUnknownType
Retrieves an object from the command's argument string without converting it to a specific type. -
isOptional
boolean isOptional()Whether the argument is optional. -
isOptionalForConsole
boolean isOptionalForConsole()Is the argument optional for non-players. -
getCursor
int getCursor()Argument number. The numbering starts with 0. -
getLocalesPath
Object[] getLocalesPath()Path to find the message that there is no matching command argument in the localization configuration. -
getClazz
Class<?> getClazz()Class of argument. -
getPermision
-
hasPermission
-