Interface PlatformService
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 Summary
Modifier and TypeMethodDescription@NotNull StringThe API contract the installed Zentrix implements; the same asZentrixAPI#getAPIVersion().@NotNull Collection<CapabilityStatus> Every built-in capability, followed by every capability addons currently report.@NotNull CapabilityStatusgetCapability(@NotNull String id) One capability.@NotNull ZentrixEditionThe installed edition.@NotNull Optional<IntegrationStatus> getIntegration(@NotNull String name) One integration by plugin name, case-insensitively.@NotNull Collection<IntegrationStatus> Every optional plugin Zentrix integrates with, installed or not.@NotNull LifecycleStateWhere Zentrix is in its startup and shutdown.@NotNull StringThe installed Zentrix plugin version, as itsplugin.ymldeclares it.@NotNull ServerPlatformThe server Zentrix runs on.@NotNull StorageStatusThe storage backend Zentrix keeps profiles and balances in.@NotNull CapabilityRegistrationregisterCapability(@NotNull org.bukkit.plugin.Plugin owner, @NotNull String id, @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.
-
Method Details
-
getPluginVersion
The installed Zentrix plugin version, as itsplugin.ymldeclares it. -
getApiVersion
The API contract the installed Zentrix implements; the same asZentrixAPI#getAPIVersion(). -
getEdition
The installed edition. -
getServer
The server Zentrix runs on. -
getLifecycleState
Where Zentrix is in its startup and shutdown. -
getIntegrations
Every optional plugin Zentrix integrates with, installed or not. -
getIntegration
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
The storage backend Zentrix keeps profiles and balances in. -
getCapability
One capability.- Parameters:
id- aZentrixCapabilitiesid, or one an addon registered- Returns:
- its status;
CapabilityState.UNKNOWNwhen nothing reports that id
-
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 thezentrixnamespace. 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 reportsCapabilityState.FAILED.- Parameters:
owner- the reporting plugin; the registration ends when it is disabledid- the namespaced capability idstatus- the capability's current status- Returns:
- the registration
- Throws:
IllegalArgumentException- if the id is not namespaced, uses thezentrixnamespace, or is already registered by an enabled plugin
-