bottle-waterBoosters API

Overview

The Booster API enables external plugins to manage and query active multipliers for players. It supports permanent and temporary boosts for economies, enchants, and damage, with built-in support for stacking and time persistence.

Getting Started

Follow these steps to integrate with the booster system.

1

Get the Instance

Access the singleton API instance from the static provider.

import me.fergs.phantomdungeons.modules.boosters.api.BoostersAPI;

// Get the singleton instance
BoostersAPI boostersAPI = BoostersAPI.get();
circle-exclamation
2

Check Availability

The API might return null if the boosters module is disabled in modules.yml.

if (boostersAPI == null) {
    getLogger().warning("Boosters module is disabled!");
    return;
}
3

Handle Offline Players

Most methods support both Player objects and UUIDs for efficient background processing.

UUID playerId = offlinePlayer.getUniqueId();
boolean isActive = boostersAPI.hasBooster(playerId, "money");

Core Operations

Checking Multipliers

Multipliers are cached in memory for zero-latency lookups. If no booster is active, the API returns 1.0.

// Get the total multiplier for a player's money gains
double multiplier = boostersAPI.getMultiplier(player, "money");

// Check if a player has any active enchantment boost
boolean boosted = boostersAPI.hasBooster(player, "enchant-void-rift");

Activating Temporary Boosters

Use this to give timed rewards (e.g., from crates or kits). The duration is in seconds.

Granting Permanent Boosters

Permanent boosters stay with the player until manually revoked.

Revoking Boosters

Remove specific boosters or clear all active boosts from a player.


Advanced Management

Time Tracking

Query the remaining life of a booster.

Stacking and Extensions

Depending on the plugin configuration, applying multiple boosters of the same type can either extend the time or increase the multiplier.


Events API

Use events to react to booster changes or customize how gains are calculated.

Booster Activated Event

Fired when a player successfully redeems or is given a booster.

Booster Expired Event

Fired when a timed booster reaches its end of life.


FAQ

chevron-rightWhat happens on logout?hashtag

Timed boosters continue to tick down based on the expiration_timestamp in the database.

chevron-rightAre multipliers additive?hashtag

Multipliers follow the stacking mode defined in the boosterconfiguration (e.g., EXTEND, REPLACE, or STACKED and more.).

chevron-rightHow do I target enchants?hashtag

Use the format enchant-{enchant_id} (e.g., enchant-void-rift) as the booster type.

chevron-rightIs data saved if the server crashes?hashtag

The system uses auto-save intervals and guarantees data write during onDisable to prevent data loss.

Last updated