Package dev.itsharshxd.zentrix.api.addon
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
-
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.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 nullIllegalStateException- 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
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
-