The BountyAPI provides methods to manage bounties programmatically.
Getting the API
Copy ZelBountyAPI api = Bukkit . getServicesManager () . load ( ZelBountyAPI . class );
BountyAPI bountyAPI = api . getBountyAPI (); Add bounty to a player.
Copy CompletableFuture< Double > addBounty( UUID target , UUID adder , double amount)
throws BountyException; Parameters:
target - UUID of the player receiving the bounty
adder - UUID of the player adding the bounty (can be null for system)
Returns: CompletableFuture<Double> - New total bounty amount
Example:
Remove bounty from a player.
Parameters:
target - UUID of the player losing bounty
remover - UUID of the player removing bounty (can be null)
amount - Amount to remove
Returns: CompletableFuture<Double> - New total bounty amount
Example:
Reset a player's bounty to 0.
Parameters:
target - UUID of the player to reset
resetter - UUID of the player performing reset (can be null)
Example:
Claim a bounty (typically called when a player is killed).
Parameters:
target - UUID of the player whose bounty is being claimed
claimer - UUID of the player claiming the bounty
Returns: CompletableFuture<Double> - Amount claimed
Example:
Get the current bounty amount for a player.
Parameters:
target - UUID of the player
Returns: Current bounty amount (0.0 if none)
Example:
Get full bounty data for a player.
Parameters:
target - UUID of the player
Returns: IBountyData object or null if not found
IBountyData Interface:
Example:
Get a list of players with the highest bounties.
Parameters:
limit - Maximum number of results
Returns: List of IBountyData sorted by bounty amount (descending)
Example:
Get bounty history for a player.
Parameters:
target - UUID of the player
limit - Maximum number of results
Returns: List of IHistoryEntry objects
IHistoryEntry Interface:
BountyAction Enum:
Example:
Check if a player has an active bounty.
Parameters:
target - UUID of the player
Returns: true if player has bounty > 0
Example:
Complete Example