Package dev.boze.api.client.module
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 ClassesModifier and TypeInterfaceDescriptionstatic classCommand argument for base modules -
Method Summary
Modifier and TypeMethodDescriptionMethod called by ArrayList to get infogetBind()Gets the current bindGets the description of this modulegetName()Gets the internal name of this moduleGets a list of this module's optionsbooleangetState()Gets whether this module is enabledgetTitle()Gets the display title of this modulebooleanGets whether this module should only be active while the bind key is heldbooleanGets whether this module is visible in the ArrayListvoidCalled when this module is disabledvoidonEnable()Called when this module is enabledvoidSets the bindvoidsetDescription(String description) Modify the description of the modulevoidsetNotify(boolean notify) Sets whether notifications should be shown when this module is toggledvoidsetOnlyWhileHolding(boolean onlyWhileHolding) Sets whether this module should only be active while the bind key is heldbooleansetState(boolean newState) Sets whether this module is enabledvoidSets the display title of this modulevoidsetVisible(boolean visible) Sets whether this module is visible in the ArrayListbooleanGets 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
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
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
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
Gets a list of this module's options- Returns:
- the list of this module's options
-