Package me.hackware.api.module
Class Module
java.lang.Object
me.hackware.api.module.Module
- All Implemented Interfaces:
SettingContainer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidActivates a module that was loaded as enabled from config.protected voidaddSettings(Setting<?>... settings) Registers multiple settings at once.protected <S extends Setting<?>>
SaddSettings(S setting) Registers a setting with this module and returns it.static voidbootstrap(Consumer<Module> saveSettings, Runnable saveStates, BooleanSupplier armed) Installed once by the client before any module is constructed.voidTears a module down for unregistration — the inverse ofactivateFromConfig().voiddefaultEnabled(boolean enabled) Declares the compile-time default enabled state (called from a module's constructor).protected voidFailure: redTextIcons.Icon.WARNING, message red too.Returns a short info/meta string for this module, displayed in the HUD module list.getName()Optional module-specific sub-commands invokable as.<module> <verb> [args].booleanhandleSubCommand(String[] args) protected voidInformational: aquaTextIcons.Icon.INFO.protected voidSends an informational message with a custom dedup key.booleanbooleanThe compile-time default enabled state declared viadefaultEnabled(boolean).booleanbooleanvoidloadEnabled(boolean enabled) Applies the enabled state read from config (no toggle callbacks, no save).protected voidprotected voidonEnable()protected Stringprefix(TextIcons.Icon icon, net.minecraft.ChatFormatting iconColor) [icon] [ModuleName]— for subclasses that need their own send (e.g.protected voidprint(TextIcons.Icon icon, net.minecraft.ChatFormatting iconColor, String message) Sendsmessageto the player's chat behind an[icon] [ModuleName]prefix, with the icon tintediconColor.voidPersist this module's settings after a value change (SettingContainer).voidsetEnabled(boolean enabled) voidsetGuiExpanded(boolean expanded) voidtoggle()protected voidAdvisory: yellowTextIcons.Icon.WARNING.
-
Constructor Details
-
Module
-
-
Method Details
-
bootstrap
public static void bootstrap(Consumer<Module> saveSettings, Runnable saveStates, BooleanSupplier armed) Installed once by the client before any module is constructed. -
getName
-
getDescription
-
getCategory
-
isEnabled
public boolean isEnabled() -
isAlwaysEnabled
public boolean isAlwaysEnabled() -
getSettings
-
getKeybind
-
getHideFeedback
-
isGuiExpanded
public boolean isGuiExpanded() -
setGuiExpanded
public void setGuiExpanded(boolean expanded) -
getExpandedGroupSlugs
-
addSettings
Registers a setting with this module and returns it. Usage:addSetting(new NumberSetting("Range").defaultValue(4.0).min(1.0).max(6.0).step(0.1)) -
addSettings
Registers multiple settings at once. -
saveContainerSettings
public void saveContainerSettings()Persist this module's settings after a value change (SettingContainer).- Specified by:
saveContainerSettingsin interfaceSettingContainer
-
toggle
public void toggle() -
setEnabled
public void setEnabled(boolean enabled) -
defaultEnabled
public void defaultEnabled(boolean enabled) Declares the compile-time default enabled state (called from a module's constructor). Modules default to off unless they call this withtrue. -
isDefaultEnabled
public boolean isDefaultEnabled()The compile-time default enabled state declared viadefaultEnabled(boolean). -
loadEnabled
public void loadEnabled(boolean enabled) Applies the enabled state read from config (no toggle callbacks, no save). -
activateFromConfig
public void activateFromConfig()Activates a module that was loaded as enabled from config. Registers to the event bus and calls onEnable() without saving config. -
deactivateForUnload
public void deactivateForUnload()Tears a module down for unregistration — the inverse ofactivateFromConfig().Runs
onDisableand drops the event subscription, but does not persist the new state or print toggle feedback. That matters for plugin unload/reload:toggle()writesenabled: falseto states.yml, which would clobber the saved enabled state that a reload is about to restore. -
onEnable
protected void onEnable() -
onDisable
protected void onDisable() -
getSubCommands
Optional module-specific sub-commands invokable as.<module> <verb> [args]. OverridegetSubCommands()to list verbs (for tab completion) andhandleSubCommand(String[])to handle them. Returntruefrom the handler when the verb was recognised, soModuleCommanddoesn't try to resolve it as a setting path. -
handleSubCommand
- See Also:
-
getInfoString
Returns a short info/meta string for this module, displayed in the HUD module list. Override in subclasses to provide live info (e.g., CPS, mode, damage). Returnnullto show no info. -
prefix
[icon] [ModuleName]— for subclasses that need their own send (e.g. no dedup). -
print
Sendsmessageto the player's chat behind an[icon] [ModuleName]prefix, with the icon tintediconColor. Replaces any previous message from this module so repeated calls don't spam — one live line per module. -
info
Informational: aquaTextIcons.Icon.INFO. -
warn
Advisory: yellowTextIcons.Icon.WARNING. -
error
Failure: redTextIcons.Icon.WARNING, message red too. -
info
Sends an informational message with a custom dedup key. Useful when a module needs several independent keyed messages.
-