Interface BaseModule

All Known Implementing Classes:
AddonModule, ClientModule

public interface BaseModule
Base interface for all modules

A module is a self-contained piece of functionality that can be enabled or disabled

Each module has a name, description, title (which can be changed), and a keybind

Modules can have settings which are automatically serialized and deserialized
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Command argument for base modules
  • Method Summary

    Modifier and Type
    Method
    Description
    Method called by ArrayList to get info
    Gets the current bind
    Gets the description of this module
    Gets the internal name of this module
    Gets a list of this module's options
    boolean
    Gets whether this module is enabled
    Gets the display title of this module
    boolean
    Gets whether this module should only be active while the bind key is held
    boolean
    Gets whether this module is visible in the ArrayList
    void
    Called when this module is disabled
    void
    Called when this module is enabled
    void
    setBind(Bind newBind)
    Sets the bind
    void
    setDescription(String description)
    Modify the description of the module
    void
    setNotify(boolean notify)
    Sets whether notifications should be shown when this module is toggled
    void
    setOnlyWhileHolding(boolean onlyWhileHolding)
    Sets whether this module should only be active while the bind key is held
    boolean
    setState(boolean newState)
    Sets whether this module is enabled
    void
    setTitle(String newTitle)
    Sets the display title of this module
    void
    setVisible(boolean visible)
    Sets whether this module is visible in the ArrayList
    boolean
    Gets whether notifications should be shown when this module is toggled
  • Method Details

    • getName

      String getName()
      Gets the internal name of this module
      Returns:
      The module's name
    • getDescription

      String getDescription()
      Gets the description of this module
      Returns:
      The module's description
    • setDescription

      void setDescription(String description)
      Modify the description of the module

      This resets when you re-launch

      Supports newline escape sequence
      Parameters:
      description - Description to set
    • getTitle

      String getTitle()
      Gets the display title of this module
      Returns:
      The module's title
    • setTitle

      void setTitle(String newTitle)
      Sets the display title of this module
      Parameters:
      newTitle - The new title
    • getState

      boolean getState()
      Gets whether this module is enabled
      Returns:
      true if the module is enabled, false otherwise
    • setState

      boolean setState(boolean newState)
      Sets whether this module is enabled

      This will call onEnable() or onDisable() as appropriate
      Parameters:
      newState - The new state
      Returns:
      true if the state changed, false if it was already in that state
    • onEnable

      void onEnable()
      Called when this module is enabled

      For many client modules, sets initial state

      Call instead of setState to not affect the state
    • onDisable

      void onDisable()
      Called when this module is disabled

      For many client modules, clears data

      In some, restores changes, i.e. Timer

      Call instead of setState to not affect the state
    • getBind

      Bind getBind()
      Gets the current bind
      Returns:
      The module's bind
    • setBind

      void setBind(Bind newBind)
      Sets the bind
      Parameters:
      newBind - The new bind
    • getArrayListInfo

      String getArrayListInfo()
      Method called by ArrayList to get info
      Returns:
      Info to show in ArrayList brackets
    • isVisible

      boolean isVisible()
      Gets whether this module is visible in the ArrayList
      Returns:
      true if the module is visible in ArrayList, false otherwise
    • setVisible

      void setVisible(boolean visible)
      Sets whether this module is visible in the ArrayList
      Parameters:
      visible - true to make the module visible in ArrayList, false to hide it
    • shouldNotify

      boolean shouldNotify()
      Gets whether notifications should be shown when this module is toggled
      Returns:
      true if notifications should be shown, false otherwise
    • setNotify

      void setNotify(boolean notify)
      Sets whether notifications should be shown when this module is toggled
      Parameters:
      notify - true to show notifications, false to hide them
    • isOnlyWhileHolding

      boolean isOnlyWhileHolding()
      Gets whether this module should only be active while the bind key is held
      Returns:
      true if the module only activates while holding the key, false for toggle behavior
    • setOnlyWhileHolding

      void setOnlyWhileHolding(boolean onlyWhileHolding)
      Sets whether this module should only be active while the bind key is held
      Parameters:
      onlyWhileHolding - true for hold-to-activate, false for toggle behavior
    • getOptions

      List<Option<?>> getOptions()
      Gets a list of this module's options
      Returns:
      the list of this module's options