Developer API
PlumDelivery provides a comprehensive Java API that allows other plugins to interact with the delivery system. You can query player data, modify points, listen to custom events, and access category/delivery information programmatically.
Requirements
- Java: 21+
- Server: Paper 1.21.8+
- PlumDelivery: v1.1+
Adding the Dependency
The API JAR is distributed with each release on GitHub. Download PlumDelivery-1.1-api.jar from the Releases page and place it in your project's libs directory.
Gradle (Groovy DSL)
repositories {
mavenCentral()
}
dependencies {
compileOnly files('libs/PlumDelivery-1.1-api.jar')
}
Gradle (Kotlin DSL)
repositories {
mavenCentral()
}
dependencies {
compileOnly(files("libs/PlumDelivery-1.1-api.jar"))
}
Maven
First, install the JAR into your local Maven repository:
mvn install:install-file \
-Dfile=libs/PlumDelivery-1.1-api.jar \
-DgroupId=net.weesli \
-DartifactId=PlumDelivery \
-Dversion=1.1 \
-Dpackaging=jar
Then add it to your pom.xml:
<dependency>
<groupId>net.weesli</groupId>
<artifactId>PlumDelivery</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
Plugin Configuration
plugin.yml
If your plugin requires PlumDelivery to function:
name: MyPlugin
version: 1.0
main: com.example.myplugin.MyPlugin
depend: [PlumDelivery]
If PlumDelivery support is optional:
name: MyPlugin
version: 1.0
main: com.example.myplugin.MyPlugin
softdepend: [PlumDelivery]
Tips
When using softdepend, always check if PlumDelivery is loaded before accessing the API:
if (Bukkit.getPluginManager().getPlugin("PlumDelivery") != null) {
// Safe to use PlumDelivery API
}
Getting the API Instance
The API is accessed through the singleton PlumDeliveryAPI class:
import net.plumstudio.plumdelivery.api.PlumDeliveryAPI;
PlumDeliveryAPI api = PlumDeliveryAPI.getInstance();
Warning
The API instance is only available after PlumDelivery has been enabled. Always access it in your plugin's onEnable() or later — never in the constructor or onLoad().
Quick Examples
Get a player's daily points in a category
PlumDeliveryAPI api = PlumDeliveryAPI.getInstance();
int points = api.getPoints(player.getUniqueId(), DeliveryType.DAILY, "mining");
player.sendMessage("Your daily mining points: " + points);
Add points to a player
PlumDeliveryAPI api = PlumDeliveryAPI.getInstance();
api.addPoints(player.getUniqueId(), DeliveryType.WEEKLY, "fishing", 5);
Check if a delivery is currently running
PlumDeliveryAPI api = PlumDeliveryAPI.getInstance();
if (api.isDeliveryRunning(DeliveryType.DAILY)) {
String timeLeft = api.getFormattedRemainingTime(DeliveryType.DAILY);
player.sendMessage("Daily delivery ends in: " + timeLeft);
}
Listen for goal completion
@EventHandler
public void onGoalReach(GoalReachEvent event) {
Player player = Bukkit.getPlayer(event.getPlayerUuid());
if (player != null) {
player.sendMessage("You completed the " + event.getCategory() + " goal!");
}
}
Retrieve user data through ApiUser
PlumDeliveryAPI api = PlumDeliveryAPI.getInstance();
ApiUser user = api.getUser(player.getUniqueId());
Map<String, Integer> allPoints = user.getAllPoints();
Map<String, Integer> allGoals = user.getAllGoals();
for (Map.Entry<String, Integer> entry : allPoints.entrySet()) {
player.sendMessage(entry.getKey() + ": " + entry.getValue() + " pts");
}
API Structure
| Class | Description |
|---|---|
PlumDeliveryAPI | Main entry point — user lookups, point operations, delivery status, categories |
ApiUser | Read-only wrapper around a player's delivery data |
ApiCategory | Category information (display name, required objects) |
DeliveryType | Enum for delivery periods: DAILY, WEEKLY, MONTHLY |
Next Steps
- Method Reference — Full documentation of every API method
- Events — Custom Bukkit events fired by PlumDelivery
