Interface AddonManager


public interface AddonManager
Tracks addon registration and lifecycle state in Zentrix.

Addons can register themselves here so the Zentrix plugin can track them. ZentrixAddon performs this registration during its lifecycle.

Example


 AddonManager addonManager = ZentrixProvider.get().getAddonManager();

 // Check registered addons
 Collection<AddonInfo> addons = addonManager.getRegisteredAddons();
 for (AddonInfo addon : addons) {
     System.out.println("Addon: " + addon.getName() + " v" + addon.getVersion());
 }

 // Check if a specific addon is registered
 if (addonManager.isAddonRegistered("my-addon")) {
     // Addon is active
 }
 
Since:
1.0.0
  • Method Details

    • registerAddon

      void registerAddon(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
      Registers an addon with Zentrix.

      If you extend ZentrixAddon, the base class registers the addon. Call this directly only for addons that do not use the base class.

      Parameters:
      plugin - The addon plugin to register
      Throws:
      IllegalArgumentException - if plugin is null
      IllegalStateException - if addon is already registered
    • unregisterAddon

      void unregisterAddon(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
      Unregisters an addon from Zentrix.

      If you extend ZentrixAddon, the base class unregisters the addon. Call this directly only for addons that do not use the base class.

      Parameters:
      plugin - The addon plugin to unregister
    • getAddon

      @NotNull @NotNull Optional<AddonManager.AddonInfo> getAddon(@NotNull @NotNull String addonId)
      Gets information about a registered addon by its ID.
      Parameters:
      addonId - The addon's unique identifier (typically the plugin name in lowercase)
      Returns:
      Optional containing the addon info, or empty if not found
    • getAddon

      @NotNull @NotNull Optional<AddonManager.AddonInfo> getAddon(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
      Gets information about a registered addon by its plugin instance.
      Parameters:
      plugin - The addon plugin
      Returns:
      Optional containing the addon info, or empty if not registered
    • getRegisteredAddons

      @NotNull @NotNull Collection<AddonManager.AddonInfo> getRegisteredAddons()
      Gets all registered addons.
      Returns:
      An unmodifiable collection of addon information (never null, may be empty)
    • isAddonRegistered

      boolean isAddonRegistered(@NotNull @NotNull String addonId)
      Checks if an addon is registered by its ID.
      Parameters:
      addonId - The addon's unique identifier
      Returns:
      true if the addon is registered
    • isAddonRegistered

      boolean isAddonRegistered(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
      Checks if an addon is registered by its plugin instance.
      Parameters:
      plugin - The addon plugin
      Returns:
      true if the addon is registered
    • getAddonCount

      int getAddonCount()
      Gets the number of registered addons.
      Returns:
      The addon count