Class ChatCommands
java.lang.Object
io.github.icrazyblaze.twitchmod.chat.ChatCommands
This class is where all the commands are registered for use in ChatPicker.
- See Also:
ChatPicker
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCommands are registered here fromChatPicker.doCommand(java.lang.String, java.lang.String).static voidinitDynamicCommands(String argString, String sender)Commands that are registered here need to be re-added to the command registry every time a command is checked because they have changing ("dynamic") arguments.static voidregisterCommand(Runnable runnable, String... keys)Adds a command to a list that ChatPicker checks.
-
Constructor Details
-
ChatCommands
public ChatCommands()
-
-
Method Details
-
registerCommand
Adds a command to a list that ChatPicker checks. TheregisterCommand(java.lang.Runnable, java.lang.String...)method takes two arguments: a runnable, and any number of command aliases.
If an entry with the same runnable or alias has already been registered, it will be replaced. IDEA will swap the lambda for a method reference wherever possible.registerCommand(() -> CommandHandlers.myCommand(), "mycommand", "mycommandalias");- Parameters:
runnable- The function linked to the commandkeys- Aliases for the command- See Also:
ChatPicker
-
initCommands
public static void initCommands()Commands are registered here fromChatPicker.doCommand(java.lang.String, java.lang.String). -
initDynamicCommands
Commands that are registered here need to be re-added to the command registry every time a command is checked because they have changing ("dynamic") arguments.- Parameters:
argString- the argument for the commandsender- the name of the command sender
-
getRegisteredCommands
- Returns:
- a sorted list of all the currently registered commands and their aliases
-