Class ZentrixProvider

java.lang.Object
dev.itsharshxd.zentrix.api.ZentrixProvider

public final class ZentrixProvider extends Object
Internal provider for the ZentrixAPI instance.

For addon developers: Use ZentrixAPI.get() instead of this class. The static methods on ZentrixAPI are the recommended way to access the API.


 // Use ZentrixAPI.get() instead (recommended)
 ZentrixAPI api = ZentrixAPI.get();
 api.getGameService().getActiveGames();
 

When to use ZentrixProvider directly

This class is primarily used internally by the Zentrix core plugin and the

invalid reference
ZentrixAddon
base class. Direct usage is only needed for advanced scenarios like manual API registration/unregistration.

Since:
1.0.0
See Also:
  • Method Details

    • get

      @NotNull public static @NotNull ZentrixAPI get()
      Gets the ZentrixAPI instance.

      Prefer using ZentrixAPI.get() instead.

      Returns:
      The API instance
      Throws:
      IllegalStateException - if the API has not been initialized yet
      See Also:
    • isAvailable

      public static boolean isAvailable()
      Checks if the ZentrixAPI is available.

      Prefer using ZentrixAPI.isAvailable() instead.

      Returns:
      true if the API is initialized and ready to use
      See Also:
    • register

      public static void register(@NotNull @NotNull ZentrixAPI api)
      Registers the API implementation.

      Internal method - DO NOT CALL FROM ADDONS.

      This method is called by the Zentrix core plugin during startup to register the API implementation. Calling this from an addon will have no effect and may cause issues.

      Parameters:
      api - The API implementation to register
      Throws:
      IllegalArgumentException - if api is null
      IllegalStateException - if API is already registered
    • unregister

      public static void unregister()
      Unregisters the API implementation.

      Internal method - DO NOT CALL FROM ADDONS.

      This method is called by the Zentrix core plugin during shutdown to unregister the API implementation.