Interface RawCommand
- All Superinterfaces:
Command
,Command.Raw
,PluginCommand
- All Known Subinterfaces:
RawPlayerCommand
This interface is designed to simplify the creation of RawSettings commands.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.command.Command
Command.Builder, Command.Parameterized, Command.Raw
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canExecute
(CommandCause cause) Determining who can use the command.default String[]
checkArguments
(CommandCause cause, String[] args, boolean isPlayer, Locale locale) default String[]
checkChildAndArguments
(CommandCause cause, String[] args, boolean isPlayer, Locale locale) default CommandTreeNode.Root
default List<CommandCompletion>
complete
(CommandCause cause, ArgumentReader.Mutable arguments) default List<CommandCompletion>
completeArgs
(CommandCause cause, List<String> args, String currentInput) Auto-complete command arguments.default List<CommandCompletion>
completeChild
(CommandCause cause, List<String> args, String currentInput) default boolean
default boolean
default boolean
If `false`, the player will not get a list of available command arguments.default CommandException
exceptionAppendUsage
(CommandCause cause, Locale locale, Object[] localePath) default CommandException
exceptionAppendUsage
(CommandCause cause, Component text) extendedDescription
(Locale locale) extendedDescription
(CommandCause cause) default <T> Optional<T>
getArgument
(Class<T> clazz, String[] args, int cursor) Deprecated.default <T> Optional<T>
getArgument
(Class<T> clazz, List<String> args, int cursor) Deprecated.default <T> Optional<T>
getArgument
(Class<T> clazz, CommandCause cause, String[] args, int cursor) Getting an object from a command argument.Map<Integer,
RawArgument<?>> Map of command arguments.default Optional<BigDecimal>
getBigDecimal
(String[] args, int cursor) default Optional<BigDecimal>
getBigDecimal
(String[] args, CommandCause cause, int cursor) getBoolean
(String[] args, int cursor) getBoolean
(String[] args, CommandCause cause, int cursor) Subcommand map.
The subcommands automatically get to the first place when the arguments are autocomplete.getCurrency
(String[] args, int cursor) getCurrency
(String[] args, CommandCause cause, int cursor) getDouble
(String[] args, CommandCause cause, int cursor) getDurationArg
(String[] args, int cursor, Locale locale) getDurationArg
(String[] args, CommandCause cause, int cursor, Locale locale) default List<CommandCompletion>
No need toOverride
any more.default Optional<EnchantmentType>
getEnchantmentType
(String[] args, int cursor) default Optional<EnchantmentType>
getEnchantmentType
(String[] args, CommandCause cause, int cursor) getInteger
(String[] args, int cursor) getInteger
(String[] args, CommandCause cause, int cursor) getLocale
(String[] args, CommandCause cause, int cursor) getLong
(String[] args, CommandCause cause, int cursor) default Optional<ServerPlayer>
default Optional<ServerPlayer>
getPlayer
(String[] args, CommandCause cause, int cursor) getString
(String[] args, CommandCause cause, int cursor) default Optional<ServerWorld>
default Optional<ServerWorld>
getWorld
(String[] args, CommandCause cause, int cursor) getWorldType
(String[] args, int cursor) getWorldType
(String[] args, CommandCause cause, int cursor) parseDouble
(String arg) Deprecated.parseDuration
(String s, Locale locale) Convert string to objectDuration
Deprecated.void
process
(CommandCause cause, Audience audience, Locale locale, boolean isPlayer, String[] args, ArgumentReader.Mutable arguments) Command code execution.default CommandResult
process
(CommandCause cause, ArgumentReader.Mutable arguments) Checks for child commands and who activated the command.default void
register
(RegisterCommandEvent<Command.Raw> event) Command registration.shortDescription
(Locale locale) shortDescription
(CommandCause cause) Methods inherited from interface sawfowl.commandpack.api.commands.PluginCommand
checkCooldown, command, delay, economy, exception, exception, exception, exception, exception, exception, exception, exception, getCommandSettings, getComponent, getComponent, getComponent, getContainer, getCooldowns, getListTexts, getLocale, getPluginLocale, getText, getText, isEnable, permission, sendPaginationList, success, text, text, timeFormat, trackingName
-
Method Details
-
process
void process(CommandCause cause, Audience audience, Locale locale, boolean isPlayer, String[] args, ArgumentReader.Mutable arguments) throws CommandException Command code execution.- Throws:
CommandException
-
shortDescription
-
extendedDescription
-
getChildExecutors
Map<String,RawCommand> getChildExecutors()Subcommand map.
The subcommands automatically get to the first place when the arguments are autocomplete. -
getArguments
Map<Integer,RawArgument<?>> getArguments()Map of command arguments. -
enableAutoComplete
default boolean enableAutoComplete()If `false`, the player will not get a list of available command arguments.
Regardless of the return value, the player will receive variants of the child commands.
This parameter will be ignored when overriding thecomplete(CommandCause, Mutable)
method. -
commandTree
- Specified by:
commandTree
in interfaceCommand.Raw
-
process
default CommandResult process(CommandCause cause, ArgumentReader.Mutable arguments) throws CommandException Checks for child commands and who activated the command.- Specified by:
process
in interfaceCommand
- Throws:
CommandException
-
complete
default List<CommandCompletion> complete(CommandCause cause, ArgumentReader.Mutable arguments) throws CommandException - Specified by:
complete
in interfaceCommand
- Throws:
CommandException
-
checkChildAndArguments
default String[] checkChildAndArguments(CommandCause cause, String[] args, boolean isPlayer, Locale locale) throws CommandException - Throws:
CommandException
-
checkArguments
default String[] checkArguments(CommandCause cause, String[] args, boolean isPlayer, Locale locale) throws CommandException - Throws:
CommandException
-
completeChild
default List<CommandCompletion> completeChild(CommandCause cause, List<String> args, String currentInput) -
completeArgs
default List<CommandCompletion> completeArgs(CommandCause cause, List<String> args, String currentInput) Auto-complete command arguments. -
shortDescription
- Specified by:
shortDescription
in interfaceCommand
-
extendedDescription
- Specified by:
extendedDescription
in interfaceCommand
-
canExecute
Determining who can use the command.- Specified by:
canExecute
in interfaceCommand
-
register
Command registration. -
parseInt
Deprecated.An attempt to convert a string to an integer. -
parseDouble
Deprecated.An attempt to convert a string to a fractional number. -
exceptionAppendUsage
default CommandException exceptionAppendUsage(CommandCause cause, Component text) throws CommandException - Throws:
CommandException
-
exceptionAppendUsage
default CommandException exceptionAppendUsage(CommandCause cause, Locale locale, Object[] localePath) throws CommandException - Throws:
CommandException
-
getWorld
-
getWorldType
-
getPlayer
-
getEnchantmentType
-
getString
-
getBoolean
-
getInteger
-
getLong
-
getDouble
-
getBigDecimal
-
getLocale
-
getCurrency
-
getDurationArg
default Optional<Duration> getDurationArg(String[] args, int cursor, Locale locale) throws CommandException - Throws:
CommandException
-
getWorld
-
getWorldType
-
getPlayer
-
getEnchantmentType
-
getString
-
getBoolean
-
getInteger
-
getLong
-
getDouble
-
getBigDecimal
-
getLocale
-
getCurrency
-
getDurationArg
default Optional<Duration> getDurationArg(String[] args, CommandCause cause, int cursor, Locale locale) throws CommandException - Throws:
CommandException
-
getArgument
Deprecated.Getting an object from a command argument. UsegetArgument(Class, CommandCause, String[], int)
- Type Parameters:
T
- - The type of the returned object.- Parameters:
clazz
- - The class of the returned object.args
- - All command arguments.cursor
- - The argument number of the command.- Returns:
Optional
-
getArgument
Deprecated. -
getArgument
Getting an object from a command argument.- Type Parameters:
T
- - The type of the returned object.- Parameters:
clazz
- - The class of the returned object.args
- - All command arguments.cursor
- - The argument number of the command.- Returns:
Optional
-
parseDuration
Convert string to objectDuration
- Throws:
CommandException
-
getEmptyCompletion
No need toOverride
any more. -
containsChild
default boolean containsChild() -
containsArgs
default boolean containsArgs()
-