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 String
Description of what this addon doesfinal AddonDispatcher
Command dispatcher for this addonfinal String
Unique identifier for this addonfinal ArrayList
<AddonModule> List of modules provided by this addonfinal String
Display name of this addonfinal String
Version string of this addon -
Constructor Summary
Constructors -
Method Summary
-
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 -
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 boolean initialize()Initializes this addon This is called when the addon is loaded. The default implementation loads the addon's configuration from disk.- Returns:
- true if initialization was successful, false otherwise
-
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:
toJson
in interfaceSerializable<Addon>
- Returns:
- The object as a JsonObject
-
fromJson
- Specified by:
fromJson
in interfaceSerializable<Addon>
- Parameters:
object
- The JsonObject to deserialize- Returns:
- The deserialized object
-