Package dev.itsharshxd.zentrix.api
Class ZentrixProvider
java.lang.Object
dev.itsharshxd.zentrix.api.ZentrixProvider
Holds the ZentrixAPI implementation for the core plugin.
Addons should use ZentrixAPI.get() instead. This class is used by the
core plugin and by ZentrixAddon during addon startup and shutdown.
Usage
// Get the API instance
ZentrixAPI api = ZentrixAPI.get();
api.getGameService().getActiveGames();
Direct use
Direct use is limited to core startup and shutdown, or to advanced cases such as manual API registration and unregistration.
- Since:
- 1.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ZentrixAPIget()Returns the ZentrixAPI instance.static booleanReturns whether the ZentrixAPI is available.static voidregister(@NotNull ZentrixAPI api) Registers the API implementation used by the core plugin.static voidRemoves the API implementation.
-
Method Details
-
get
Returns the ZentrixAPI instance.Addons should call
ZentrixAPI.get()instead.- Returns:
- The API instance
- Throws:
IllegalStateException- if the API has not been initialized yet- See Also:
-
isAvailable
public static boolean isAvailable()Returns whether the ZentrixAPI is available.Addons should call
ZentrixAPI.isAvailable()instead.- Returns:
trueif the API is initialized and ready to use- See Also:
-
register
Registers the API implementation used by the core plugin.Internal method. Addons must not call this.
The core plugin calls this during startup. Calling it from an addon has no useful effect and may cause problems.
- Parameters:
api- The API implementation to register- Throws:
IllegalArgumentException- if api is nullIllegalStateException- if API is already registered
-
unregister
public static void unregister()Removes the API implementation.Internal method. Addons must not call this.
The core plugin calls this during shutdown.
-