Package sawfowl.commandpack.api.commands
Interface PluginCommand
- All Known Subinterfaces:
ParameterizedCommand,ParameterizedPlayerCommand,RawCommand,RawPlayerCommand
public interface PluginCommand
An auxiliary interface for creating commands.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidcheckCooldown(CommandCause cause, Locale locale, boolean isPlayer) command()The main alias of the command.static BigDecimalcreateDecimal(double value) default voiddelay(ServerPlayer player, Locale locale, sawfowl.commandpack.commands.ThrowingConsumer<PluginCommand, CommandException> consumer) Code execution delay.
Automatically activates the command's execution fee if required by the command's settings.default voideconomy(ServerPlayer player, Locale locale) Payment for the execution of the command.default CommandExceptionOutputs an error message when the command is executed.default CommandExceptionOutputs a localized error message during command execution.default CommandExceptiondefault CommandExceptiondefault CommandExceptiondefault CommandExceptiondefault CommandExceptionOutputs an error message when the command is executed.default CommandExceptionOutputs an error message when the command is executed.Command settings.
This is where you specify the aliases, kooldowns, delays, and price.getComponent(Object[] path) Retrieving text from a specified location.default ComponentgetComponent(Locale locale, Object... path) Getting a localized message.default ComponentgetComponent(ServerPlayer player, Object[] path) Getting a localized message for the player.org.spongepowered.plugin.PluginContainerPluginContainerto which the command will be registered.getListTexts(Locale locale, Object... path) default LocalegetLocale(CommandCause cause) default <T extends LocaleReference>
TgetPluginLocale(Class<T> localeClass, Locale locale) default TextGetting a localized message.default TextgetText(ServerPlayer player, Object[] path) Getting a localized message for the player.default booleanisEnable()The permission needed to execute the command.default voidsendPaginationList(Audience target, Component title, Component padding, int linesPerPage, List<Component> components) Sending a multi-page list of text.default CommandResultsuccess()default Componentdefault ComponentSerialization of text.default ComponenttimeFormat(long second, Locale locale) Time formatting.default StringThe name of the command for which the last execution time will be checked.
For example, commands such as `/day`, `/night` are checked as `/time`.
By default, it is unique for each command.
-
Method Details
-
getCommandSettings
Settings getCommandSettings()Command settings.
This is where you specify the aliases, kooldowns, delays, and price. -
getComponent
Retrieving text from a specified location. You can return null, but in which case you need to create localized messages in LocaleAPI. -
getContainer
org.spongepowered.plugin.PluginContainer getContainer()PluginContainerto which the command will be registered. -
permission
String permission()The permission needed to execute the command. -
command
String command()The main alias of the command. -
trackingName
The name of the command for which the last execution time will be checked.
For example, commands such as `/day`, `/night` are checked as `/time`.
By default, it is unique for each command. Overriding it may be useful in some situations. -
checkCooldown
default void checkCooldown(CommandCause cause, Locale locale, boolean isPlayer) throws CommandException - Throws:
CommandException
-
getCooldowns
-
getComponent
Getting a localized message for the player. -
getText
Getting a localized message for the player. -
getLocale
-
getComponent
Getting a localized message. -
getText
Getting a localized message. -
getListTexts
-
success
-
text
Serialization of text. -
text
-
exception
Outputs an error message when the command is executed.- Throws:
CommandException
-
exception
Outputs an error message when the command is executed.- Throws:
CommandException
-
exception
Outputs an error message when the command is executed.- Throws:
CommandException
-
exception
Outputs a localized error message during command execution.- Throws:
CommandException
-
exception
default CommandException exception(Locale locale, Object[] path, String replaceKey, Component replaceValue) throws CommandException - Throws:
CommandException
-
exception
default CommandException exception(Locale locale, Object[] path, String key, String value) throws CommandException - Throws:
CommandException
-
exception
default CommandException exception(Locale locale, Object[] path, String[] keys, String... values) throws CommandException - Throws:
CommandException
-
exception
default CommandException exception(Locale locale, Object[] path, String[] keys, Component... values) throws CommandException - Throws:
CommandException
-
timeFormat
Time formatting. -
delay
default void delay(ServerPlayer player, Locale locale, sawfowl.commandpack.commands.ThrowingConsumer<PluginCommand, CommandException> consumer) throws CommandExceptionCode execution delay.
Automatically activates the command's execution fee if required by the command's settings.- Throws:
CommandException
-
economy
Payment for the execution of the command.- Throws:
CommandException
-
createDecimal
-
sendPaginationList
default void sendPaginationList(Audience target, Component title, Component padding, int linesPerPage, List<Component> components) Sending a multi-page list of text. -
getPluginLocale
-
isEnable
default boolean isEnable()
-