Package dev.boze.api.addon
Class AddonModule
java.lang.Object
dev.boze.api.addon.AddonModule
- All Implemented Interfaces:
BaseModule,Serializable<AddonModule>
Base class for all addon 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/interfaces inherited from interface dev.boze.api.client.module.BaseModule
BaseModule.BaseModuleArgument -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAddonModule(String name, String description) Creates a new module -
Method Summary
Modifier and TypeMethodDescriptionfromJson(com.google.gson.JsonObject object) Method called by ArrayList to get infogetBind()Gets the current keybindGets the keybind optionGets 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 keybindvoidsetDescription(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 toggledcom.google.gson.JsonObjecttoJson()
-
Field Details
-
options
List of settings for this module
-
-
Constructor Details
-
AddonModule
Creates a new module- Parameters:
name- Internal name of this moduledescription- Description of what this module does
-
-
Method Details
-
getName
Gets the internal name of this module- Specified by:
getNamein interfaceBaseModule- Returns:
- The module's name
-
getTitle
Gets the display title of this module- Specified by:
getTitlein interfaceBaseModule- Returns:
- The module's title
-
setTitle
Sets the display title of this module- Specified by:
setTitlein interfaceBaseModule- Parameters:
newTitle- The new title
-
getDescription
Gets the description of this module- Specified by:
getDescriptionin interfaceBaseModule- Returns:
- The module's description
-
setDescription
Modify the description of the module This resets when you re-launch Supports newline escape sequence- Specified by:
setDescriptionin interfaceBaseModule- Parameters:
description- Description to set
-
getState
public boolean getState()Gets whether this module is enabled- Specified by:
getStatein interfaceBaseModule- Returns:
- true if the module is enabled, false otherwise
-
setState
public boolean setState(boolean newState) Sets whether this module is enabled This will call onEnable() or onDisable() as appropriate- Specified by:
setStatein interfaceBaseModule- Parameters:
newState- The new state- Returns:
- true if the state changed, false if it was already in that state
-
onEnable
public void onEnable()Called when this module is enabled Override this to add custom enable behavior- Specified by:
onEnablein interfaceBaseModule
-
onDisable
public void onDisable()Called when this module is disabled Override this to add custom disable behavior- Specified by:
onDisablein interfaceBaseModule
-
getBind
Gets the current keybind- Specified by:
getBindin interfaceBaseModule- Returns:
- The module's keybind
-
setBind
Sets the keybind- Specified by:
setBindin interfaceBaseModule- Parameters:
newBind- The new keybind
-
getArrayListInfo
Method called by ArrayList to get info- Specified by:
getArrayListInfoin interfaceBaseModule- Returns:
- Info to show in ArrayList brackets
-
isVisible
public boolean isVisible()Gets whether this module is visible in the ArrayList- Specified by:
isVisiblein interfaceBaseModule- Returns:
- true if the module is visible in ArrayList, false otherwise
-
setVisible
public void setVisible(boolean visible) Sets whether this module is visible in the ArrayList- Specified by:
setVisiblein interfaceBaseModule- Parameters:
visible- true to make the module visible in ArrayList, false to hide it
-
shouldNotify
public boolean shouldNotify()Gets whether notifications should be shown when this module is toggled- Specified by:
shouldNotifyin interfaceBaseModule- Returns:
- true if notifications should be shown, false otherwise
-
setNotify
public void setNotify(boolean notify) Sets whether notifications should be shown when this module is toggled- Specified by:
setNotifyin interfaceBaseModule- Parameters:
notify- true to show notifications, false to hide them
-
isOnlyWhileHolding
public boolean isOnlyWhileHolding()Gets whether this module should only be active while the bind key is held- Specified by:
isOnlyWhileHoldingin interfaceBaseModule- Returns:
- true if the module only activates while holding the key, false for toggle behavior
-
setOnlyWhileHolding
public void setOnlyWhileHolding(boolean onlyWhileHolding) Sets whether this module should only be active while the bind key is held- Specified by:
setOnlyWhileHoldingin interfaceBaseModule- Parameters:
onlyWhileHolding- true for hold-to-activate, false for toggle behavior
-
getOptions
Gets a list of this module's options- Specified by:
getOptionsin interfaceBaseModule- Returns:
- the list of this module's options
-
getBindOption
Gets the keybind option- Returns:
- The module's bind option
-
toJson
public com.google.gson.JsonObject toJson()- Specified by:
toJsonin interfaceSerializable<AddonModule>- Returns:
- The object as a JsonObject
-
fromJson
- Specified by:
fromJsonin interfaceSerializable<AddonModule>- Parameters:
object- The JsonObject to deserialize- Returns:
- The deserialized object
-