-
-
Notifications
You must be signed in to change notification settings - Fork 170
APIv5
Welcome to using Plan API v5.
Currently the API is limited to DataExtension API, but eventually it will contain a few services.
A way to identify what API version is being provided will be available in the next update for the API.
API module Version | Plan Version |
---|---|
0.0.3 | 4.8.0 |
This section is about API v0.0.4 which is set for release with 4.8.2
API module dependency information
Plan API is distributed via Bintray repository:
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bintray-rsl1122-Plan-repository</id>
<name>bintray</name>
<url>https://dl.bintray.com/rsl1122/Plan-repository</url>
</repository>
<dependency>
<groupId>com.djrapitops</groupId>
<artifactId>Plan-api</artifactId>
<version>...</version>
</dependency>
Dependency version information can be found here: https://bintray.com/rsl1122/Plan-repository/Plan-API
Remember to add "Plan"
as a softdependency to your plugin information (plugin.yml / Plugin annotation).
Checking if the API supports a capability
-
CapabilityService
allows you to ensure that Plan version on the server has all the API capabilities you need available. - All Plan API related things should be done in it's own class to avoid NoClassDefFoundError if Plan is not installed. Below is an example of a capability check.
class ClassWhereYouDoAllPlanThings {
public boolean areAllCapabilitiesAvailable() {
try {
CapabilityService capabilities = CapabilityService.getInstance();
return capabilities.hasCapability("DATA_EXTENSION_VALUES") && ...;
} catch (NoClassDefFoundError e) {
return false;
}
}
public void doOtherPlanThings() {...}
}
- Capability names can be found in
com.djrapitops.plan.capability.Capability
enum. Please note that this class is package private to avoid direct calls that might lead to NoSuchFieldError. - The required capabilities are listed in the documentations below.
- Documentation for DataExtension API
- Since: 4.8.0
DataExtension API is for adding data of plugins to Plan. The provided data is placed in Plan database, so that it can be accessed on servers in the network. The values are displayed on the web panel, and so server admins get a more complete picture of what is going on their server. In addition basic calculations are performed on the provided values, such as totals, averages and percentages.
Older API is still available on the plugin, although it requires manual installation of the full plugin as dependency.
Deprecation Warning
Plan API will be deprecated in the near future. While it will still be available, its functionality will be routed to the new APIs when it becomes possible.
The old API has not been stable in the past, and stability of the old API can not be guaranteed in the future, hence the deprecation. PluginData API is eventually to be replaced by the DataExtension API, so it is not recommended to implement new users of this API.