Getting started

ZelBounty provides a comprehensive API for third-party plugin integration.

Getting the API

ZelBounty registers its API as a Bukkit service. Access it like this:

import com.kammoun.api.ZelBountyAPI;
import com.kammoun.api.BountyAPI;
import com.kammoun.api.PlayerDataAPI;

public class MyPlugin extends JavaPlugin {

    private ZelBountyAPI zelBountyAPI;
    private BountyAPI bountyAPI;
    private PlayerDataAPI playerDataAPI;

    @Override
    public void onEnable() {
        // Get the main API
        zelBountyAPI = Bukkit.getServicesManager().load(ZelBountyAPI.class);

        if (zelBountyAPI == null) {
            getLogger().warning("ZelBounty not found!");
            return;
        }

        // Check if enabled
        if (!zelBountyAPI.isEnabled()) {
            getLogger().warning("ZelBounty is not enabled!");
            return;
        }

        // Get sub-APIs
        bountyAPI = zelBountyAPI.getBountyAPI();
        playerDataAPI = zelBountyAPI.getPlayerDataAPI();

        getLogger().info("ZelBounty API loaded! Version: " + zelBountyAPI.getVersion());
    }
}

API Components

ZelBountyAPI

The main API interface providing access to all sub-APIs.

Maven/Gradle Dependency

To use the API in your project, add the ZelBounty Jar as a dependency.

plugin.yml

Gradle

Thread Safety

  • All API methods that modify data return CompletableFuture for async operations

  • Read operations are synchronous but thread-safe

  • Use .join() or .thenAccept() to handle async results

Async Example

Exception Handling

The API may throw these exceptions:

Exception
Description

BountyException

Base exception for bounty operations

InsufficientFundsException

Player doesn't have enough money

InvalidBountyException

Invalid bounty amount

Last updated