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 void
checkCooldown
(CommandCause cause, Locale locale, boolean isPlayer) command()
The main alias of the command.static BigDecimal
createDecimal
(double value) default void
delay
(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 void
economy
(ServerPlayer player, Locale locale) Payment for the execution of the command.default CommandException
Outputs an error message when the command is executed.default CommandException
Outputs a localized error message during command execution.default CommandException
default CommandException
default CommandException
default CommandException
default CommandException
Outputs an error message when the command is executed.default CommandException
Outputs 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 Component
getComponent
(Locale locale, Object... path) Getting a localized message.default Component
getComponent
(ServerPlayer player, Object[] path) Getting a localized message for the player.org.spongepowered.plugin.PluginContainer
PluginContainer
to which the command will be registered.getListTexts
(Locale locale, Object... path) default Locale
getLocale
(CommandCause cause) default <T extends LocaleReference>
TgetPluginLocale
(Class<T> localeClass, Locale locale) default Text
Getting a localized message.default Text
getText
(ServerPlayer player, Object[] path) Getting a localized message for the player.default boolean
isEnable()
The permission needed to execute the command.default void
sendPaginationList
(Audience target, Component title, Component padding, int linesPerPage, List<Component> components) Sending a multi-page list of text.default CommandResult
success()
default Component
default Component
Serialization of text.default Component
timeFormat
(long second, Locale locale) Time formatting.default String
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.
-
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()PluginContainer
to 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()
-