public interface AddonRegistry
Manages the lifecycle of addons, including loading, enabling, disabling,
and unloading addons.
-
Method Summary
Retrieves an addon by its class type.
Retrieves an addon by its name.
Gets the plugin that this addon manager is associated with.
boolean
Loads an addon from the given file.
boolean
Checks if an addon is currently enabled.
void
Enables a specific addon.
void
void
Disables a specific addon.
void
Unloads a specific addon, removing it from memory.
-
Method Details
-
getPlugin
Gets the plugin that this addon manager is associated with.
- Returns:
- the JavaPlugin instance.
-
initAddon
boolean initAddon(File file)
Loads an addon from the given file.
- Parameters:
-
file - the addon file to load.
- Returns:
- true if the addon was loaded successfully, false otherwise.
-
loadAddon
void loadAddon(Addon addon)
Enables a specific addon.
- Parameters:
-
addon - the addon to enable.
-
unloadAddon
void unloadAddon(Addon addon)
Disables a specific addon.
- Parameters:
-
addon - the addon to disable.
-
unregisterAddon
void unregisterAddon(Addon addon)
throws IOException
Unloads a specific addon, removing it from memory.
- Parameters:
-
addon - the addon to unload.
- Throws:
IOException
-
getAddon
<T extends Addon> T getAddon(Class<T> addonClazz)
Retrieves an addon by its class type.
- Type Parameters:
-
T - the addon type.
- Parameters:
-
addonClazz - the class type of the addon.
- Returns:
- the addon instance if found, otherwise null.
-
getAddon
Addon getAddon(String name)
Retrieves an addon by its name.
- Parameters:
-
name - the name of the addon.
- Returns:
- the addon instance if found, otherwise null.
-
isAddonEnabled
boolean isAddonEnabled(String name)
Checks if an addon is currently enabled.
- Parameters:
-
name - the name of the addon.
- Returns:
- true if the addon is enabled, false otherwise.
-
Last updated about 1 month ago