Class Addon

java.lang.Object
dev.boze.api.addon.Addon
All Implemented Interfaces:
Serializable<Addon>

public abstract class Addon extends Object implements 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 Details

    • id

      public final String id
      Unique identifier for this addon
    • name

      public final String name
      Display name of this addon
    • description

      public final String description
      Description of what this addon does
    • version

      public final String version
      Version string of this addon
    • modules

      public final ArrayList<AddonModule> modules
      List of modules provided by this addon
    • dispatcher

      public final AddonDispatcher dispatcher
      Command dispatcher for this addon
  • Constructor Details

    • Addon

      public Addon(String id, String name, String description, String version)
      Creates a new addon with a default dispatcher
      Parameters:
      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
    • 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 addon
      name - Display name of this addon
      description - Description of what this addon does
      version - Version string of this addon
      dispatcher - 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

      public File 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 interface Serializable<Addon>
      Returns:
      The object as a JsonObject
    • fromJson

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