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.
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 Summary
FieldsModifier and TypeFieldDescriptionfinal ClientModuleThe parent client module this extension extends -
Constructor Summary
ConstructorsConstructorDescriptionClientModuleExtension(ClientModule parent) Creates a new client module extension -
Method Summary
Modifier and TypeMethodDescriptionfinal voiddisable()Called internally when the extension should be disabled
Calls onDisable() and unsubscribes from event busfinal voidenable()Called internally when the extension should be enabled
Subscribes to event bus and calls onEnable()fromJson(com.google.gson.JsonObject object) voidCalled 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.voidonEnable()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.com.google.gson.JsonObjecttoJson()
-
Field Details
-
parent
The parent client module this extension extends
-
-
Constructor Details
-
ClientModuleExtension
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:
toJsonin interfaceSerializable<ClientModuleExtension>- Returns:
- The object as a JsonObject
-
fromJson
- Specified by:
fromJsonin interfaceSerializable<ClientModuleExtension>- Parameters:
object- The JsonObject to deserialize- Returns:
- The deserialized object
-