Class ChatCommands

java.lang.Object
io.github.icrazyblaze.twitchmod.chat.ChatCommands

public class ChatCommands extends Object
This class is where all the commands are registered for use in ChatPicker.
See Also:
ChatPicker
  • Constructor Details

    • ChatCommands

      public ChatCommands()
  • Method Details

    • registerCommand

      public static void registerCommand(Runnable runnable, String... keys)
      Adds a command to a list that ChatPicker checks. The registerCommand(java.lang.Runnable, java.lang.String...) method takes two arguments: a runnable, and any number of command aliases.
       
           registerCommand(() -> CommandHandlers.myCommand(), "mycommand", "mycommandalias");
       
       
      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.
      Parameters:
      runnable - The function linked to the command
      keys - Aliases for the command
      See Also:
      ChatPicker
    • initCommands

      public static void initCommands()
    • initDynamicCommands

      public static void initDynamicCommands(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.
      Parameters:
      argString - the argument for the command
      sender - the name of the command sender
    • getRegisteredCommands

      public static List<String> getRegisteredCommands()
      Returns:
      a sorted list of all the currently registered commands and their aliases