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
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 TypeMethodDescriptionprotected voidcreateCategory(String name) Creates a custom GUI category for this addon's modules.fromJson(com.google.gson.JsonObject object) Gets this addon's custom category name.getDir()Gets the addon's directory
Creates the directory if it doesn't existabstract booleanInitializes this addon
Register your modules, extensions, and commands herevoidload()Loads the addon config
This is called when the client config is loaded.voidCalled afterload()once all addons have been created.voidshutdown()Shuts down this addon
This is called when the addon is unloaded.com.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
-
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
-
createCategory
Creates a custom GUI category for this addon's modules.
An addon may create at most one category; the first call wins and later calls are ignored. When set, all of this addon's modules appear under this category in the GUI as their own element instead of the shared "Addons" category. Call this frominitialize().- Parameters:
name- Display name of the category
-
getCategory
Gets this addon's custom category name.- Returns:
- The category name, or null if this addon uses the shared "Addons" category
-
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
-