Interface PlatformService


public interface PlatformService
What the installed Zentrix is and what it can do on this server.

Use it to decide on prerequisites before registering content: a method that exists in the API can still be unavailable because of the installed edition, a missing or outdated dependency, or the server's configuration. getCapability(String) says which, and whether it may change without touching the installation.

Example


 PlatformService platform = ZentrixAPI.get().getPlatformService();
 CapabilityStatus gliders = platform.getCapability(ZentrixCapabilities.GLIDER_DEPLOYMENT);
 if (!gliders.isAvailable()) {
     getLogger().info("Sky drops will fall without a glider: " + gliders.reason());
 }
 

No secret is ever exposed here: no license key, database credential or connection string. Every method may be called from any thread; the answers are snapshots.

Since:
1.8.0
  • Method Details

    • getPluginVersion

      @NotNull @NotNull String getPluginVersion()
      The installed Zentrix plugin version, as its plugin.yml declares it.
    • getApiVersion

      @NotNull @NotNull String getApiVersion()
      The API contract the installed Zentrix implements; the same as ZentrixAPI#getAPIVersion().
    • getEdition

      @NotNull @NotNull ZentrixEdition getEdition()
      The installed edition.
    • getServer

      @NotNull @NotNull ServerPlatform getServer()
      The server Zentrix runs on.
    • getLifecycleState

      @NotNull @NotNull LifecycleState getLifecycleState()
      Where Zentrix is in its startup and shutdown.
    • getIntegrations

      @NotNull @NotNull Collection<IntegrationStatus> getIntegrations()
      Every optional plugin Zentrix integrates with, installed or not.
    • getIntegration

      @NotNull @NotNull Optional<IntegrationStatus> getIntegration(@NotNull @NotNull String name)
      One integration by plugin name, case-insensitively.
      Parameters:
      name - the plugin name, such as "WorldGuard"
      Returns:
      the integration, or empty when Zentrix does not integrate with that plugin
    • getStorageStatus

      @NotNull @NotNull StorageStatus getStorageStatus()
      The storage backend Zentrix keeps profiles and balances in.
    • getCapability

      @NotNull @NotNull CapabilityStatus getCapability(@NotNull @NotNull String id)
      One capability.
      Parameters:
      id - a ZentrixCapabilities id, or one an addon registered
      Returns:
      its status; CapabilityState.UNKNOWN when nothing reports that id
    • getCapabilities

      @NotNull @NotNull Collection<CapabilityStatus> getCapabilities()
      Every built-in capability, followed by every capability addons currently report.
    • registerCapability

      @NotNull @NotNull CapabilityRegistration registerCapability(@NotNull @NotNull org.bukkit.plugin.Plugin owner, @NotNull @NotNull String id, @NotNull @NotNull Supplier<CapabilityStatus> status)
      Reports a capability of the caller's own, so other addons can depend on it the same way they depend on Zentrix's.

      The id must be namespaced, namespace:name, and may not use the zentrix namespace. The supplier is asked whenever the capability is read, on the reader's thread, so it must be cheap and thread-safe; the id and provider of what it returns are replaced with the registered ones. A supplier that throws reports CapabilityState.FAILED.

      Parameters:
      owner - the reporting plugin; the registration ends when it is disabled
      id - the namespaced capability id
      status - the capability's current status
      Returns:
      the registration
      Throws:
      IllegalArgumentException - if the id is not namespaced, uses the zentrix namespace, or is already registered by an enabled plugin