Package com.djrapitops.plan.capability
Interface CapabilityService
-
public interface CapabilityService
Service for figuring out provided API capabilities.registerEnableListener(Consumer)
to be notified of Plan reloadshasCapability(String)
to check if a capability is available.See
Capability
for list of capabilities provided by the current version.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
CapabilityService.ListHolder
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static CapabilityService
getInstance()
Obtain instance of CapabilityService.default boolean
hasCapability(java.lang.String capabilityName)
Check if the API on the current version provides a capability.default void
registerEnableListener(java.util.function.Consumer<java.lang.Boolean> isEnabledListener)
Register a method to be called when Plan reloads.
-
-
-
Method Detail
-
getInstance
static CapabilityService getInstance()
Obtain instance of CapabilityService.- Returns:
- CapabilityService implementation.
- Throws:
java.lang.NoClassDefFoundError
- If Plan is not installed and this class can not be found or if older Plan version is installed.java.lang.IllegalStateException
- If Plan is installed, but not enabled.
-
registerEnableListener
default void registerEnableListener(java.util.function.Consumer<java.lang.Boolean> isEnabledListener)
Register a method to be called when Plan reloads.- Parameters:
isEnabledListener
- The boolean given to the method tells if Plan has enabled successfully.
-
hasCapability
default boolean hasCapability(java.lang.String capabilityName)
Check if the API on the current version provides a capability.- Parameters:
capabilityName
- Name of a capability- Returns:
- true if the capability is available.
- See Also:
for different capabilityNames.
-
-