Package dev.itsharshxd.zentrix.api.addon
Interface AddonManager
public interface AddonManager
Manages Zentrix addon lifecycle and registration.
This manager handles the registration of third-party addons that extend Zentrix functionality. Addons can register themselves to be tracked and managed by the Zentrix plugin.
Example Usage
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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents information about a registered addon. -
Method Summary
Modifier and TypeMethodDescription@NotNull Optional<AddonManager.AddonInfo> Gets information about a registered addon by its ID.@NotNull Optional<AddonManager.AddonInfo> getAddon(@NotNull org.bukkit.plugin.Plugin plugin) Gets information about a registered addon by its plugin instance.intGets the number of registered addons.@NotNull Collection<AddonManager.AddonInfo> Gets all registered addons.booleanisAddonRegistered(@NotNull String addonId) Checks if an addon is registered by its ID.booleanisAddonRegistered(@NotNull org.bukkit.plugin.Plugin plugin) Checks if an addon is registered by its plugin instance.voidregisterAddon(@NotNull org.bukkit.plugin.Plugin plugin) Registers an addon with Zentrix.voidunregisterAddon(@NotNull org.bukkit.plugin.Plugin plugin) Unregisters an addon from Zentrix.
-
Method Details
-
registerAddon
void registerAddon(@NotNull @NotNull org.bukkit.plugin.Plugin plugin) Registers an addon with Zentrix.Note: If you extend
ZentrixAddon, registration is handled automatically. Only call this directly if you're not using the base class.- Parameters:
plugin- The addon plugin to register- Throws:
IllegalArgumentException- if plugin is nullIllegalStateException- if addon is already registered
-
unregisterAddon
void unregisterAddon(@NotNull @NotNull org.bukkit.plugin.Plugin plugin) Unregisters an addon from Zentrix.Note: If you extend
ZentrixAddon, unregistration is handled automatically. Only call this directly if you're not using the base class.- Parameters:
plugin- The addon plugin to unregister
-
getAddon
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
Gets all registered addons.- Returns:
- An unmodifiable collection of addon information (never null, may be empty)
-
isAddonRegistered
Checks if an addon is registered by its ID.- Parameters:
addonId- The addon's unique identifier- Returns:
trueif 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:
trueif the addon is registered
-
getAddonCount
int getAddonCount()Gets the number of registered addons.- Returns:
- The addon count
-