Class ZentrixProvider

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

public final class ZentrixProvider extends Object
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 Details

    • get

      @NotNull public static @NotNull ZentrixAPI 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:
      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 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 null
      IllegalStateException - 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.