Package dev.boze.api.addon
Class Addon
java.lang.Object
dev.boze.api.addon.Addon
- All Implemented Interfaces:
Serializable<Addon>
Base class for all Boze addons
An addon is a self-contained extension that can add new functionality to Boze
Each addon has a unique identifier, name, description, and version
Addons can contain multiple modules and commands, which are managed through the addon's dispatcher
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringDescription of what this addon doesfinal AddonDispatcherCommand dispatcher for this addonfinal ArrayList<ClientModuleExtension> List of client module extensions provided by this addonfinal StringUnique identifier for this addonfinal ArrayList<AddonModule> List of modules provided by this addonfinal StringDisplay name of this addonfinal StringVersion string of this addon -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromJson(com.google.gson.JsonObject object) getDir()Gets the addon's directoryabstract booleanInitializes this addonvoidload()Loads the addon configvoidCalled afterload()once all addons have been created.voidshutdown()Shuts down this addoncom.google.gson.JsonObjecttoJson()
-
Field Details
-
id
Unique identifier for this addon -
name
Display name of this addon -
description
Description of what this addon does -
version
Version string of this addon -
modules
List of modules provided by this addon -
extensions
List of client module extensions provided by this addon -
dispatcher
Command dispatcher for this addon
-
-
Constructor Details
-
Addon
Creates a new addon with a default dispatcher- Parameters:
id- Unique identifier for this addonname- Display name of this addondescription- Description of what this addon doesversion- Version string of this addon
-
Addon
public Addon(String id, String name, String description, String version, AddonDispatcher dispatcher) Creates a new addon with a custom dispatcher- Parameters:
id- Unique identifier for this addonname- Display name of this addondescription- Description of what this addon doesversion- Version string of this addondispatcher- Custom command dispatcher for this addon
-
-
Method Details
-
initialize
public abstract boolean initialize()Initializes this addon Register your modules, extensions, and commands here- Returns:
- true if initialization was successful, false otherwise
-
load
public void load()Loads the addon config This is called when the client config is loaded. -
postInitialize
public void postInitialize()Called afterload()once all addons have been created. Addons may override this to perform post-load initialization that relies on config data. -
shutdown
public void shutdown()Shuts down this addon This is called when the addon is unloaded. The default implementation saves the addon's configuration to disk. -
getDir
Gets the addon's directory Creates the directory if it doesn't exist- Returns:
- The addon's directory
-
toJson
public com.google.gson.JsonObject toJson()- Specified by:
toJsonin interfaceSerializable<Addon>- Returns:
- The object as a JsonObject
-
fromJson
- Specified by:
fromJsonin interfaceSerializable<Addon>- Parameters:
object- The JsonObject to deserialize- Returns:
- The deserialized object
-