Class ClientModuleExtension

java.lang.Object
dev.boze.api.client.module.ClientModuleExtension
All Implemented Interfaces:
Serializable<ClientModuleExtension>

public abstract class ClientModuleExtension extends Object implements Serializable<ClientModuleExtension>
ClientModuleExtension

Allows extending client modules with additional functionality, settings, and listeners without modifying the core module code.

Extensions can define settings using Option fields, and override onEnable/onDisable to add custom behavior. The extension will automatically subscribe/unsubscribe to the event bus when enabled/disabled.
  • Field Details

    • parent

      public final ClientModule parent
      The parent client module this extension extends
  • Constructor Details

    • ClientModuleExtension

      public ClientModuleExtension(ClientModule parent)
      Creates a new client module extension
      Parameters:
      parent - The client module to extend
  • Method Details

    • onEnable

      public void onEnable()
      Called when the extension is enabled

      This does NOT override the module's onEnable method, but allows you to add additional behavior on top of the module's enable logic.

      The extension is automatically subscribed to the event bus before this is called.
    • onDisable

      public void onDisable()
      Called when the extension is disabled

      This does NOT override the module's onDisable method, but allows you to add additional behavior on top of the module's disable logic.

      The extension is automatically unsubscribed from the event bus after this is called.
    • enable

      public final void enable()
      Called internally when the extension should be enabled

      Subscribes to event bus and calls onEnable()
    • disable

      public final void disable()
      Called internally when the extension should be disabled

      Calls onDisable() and unsubscribes from event bus
    • toJson

      public com.google.gson.JsonObject toJson()
      Specified by:
      toJson in interface Serializable<ClientModuleExtension>
      Returns:
      The object as a JsonObject
    • fromJson

      public ClientModuleExtension fromJson(com.google.gson.JsonObject object)
      Specified by:
      fromJson in interface Serializable<ClientModuleExtension>
      Parameters:
      object - The JsonObject to deserialize
      Returns:
      The deserialized object