chart-line-upSummary API

Overview

The Summary API provides a clean interface for external plugins to interact with PhantomDungeons periodic summary system. Track player gains (currency, levels, etc.) and display them in timed intervals, keeping players informed of their progress.

Getting Started

1

Get the API Instance

In your plugin's onEnable, grab the API instance.

import me.fergs.phantomdungeons.modules.summary.api.SummaryAPI;

// Get the singleton instance
SummaryAPI summaryAPI = SummaryAPI.get();
circle-exclamation
2

Cache for Performance

Store it in your main plugin class.

public class MyPlugin extends JavaPlugin {
    private SummaryAPI summaryAPI;
    
    @Override
    public void onEnable() {
        try {
            this.summaryAPI = SummaryAPI.get();
        } catch (IllegalStateException e) {
            getLogger().warning("PhantomDungeons not loaded!");
        }
    }
}
3

Safe Null Checks

Always check availability before using.

if (summaryAPI == null) {
    getLogger().warning("Summary API not available!");
    return;
}

Core Operations

Tracking Currency Gains

Record currency gains for a player. These accumulate and display in periodic summaries.

// Track currency gain for a player
summaryAPI.trackCurrencyGain(player, "money", BigDecimal.valueOf(1000));
summaryAPI.trackCurrencyGain(player, "souls", BigDecimal.valueOf(50));

// Track by UUID (safe for offline players)
summaryAPI.trackCurrencyGain(uuid, "money", BigDecimal.valueOf(1000));
circle-check

Tracking Level Gains

Record level progression for a player.

Querying Player Data

Retrieve accumulated gains for a player.

Summary Management

Control when summaries are sent or cleared.

Frequently Asked Questions

chevron-rightHow often are summaries sent?hashtag

Summaries are sent based on the interval setting in config.yml (default: 60 seconds). This can be changed and reloaded without restarting the server.

chevron-rightAre summaries persistent across restarts?hashtag

No. Summary data is session-based and resets after each display and when players log out. It's designed for real-time progress tracking, not long-term statistics.

chevron-rightCan I customize the summary format?hashtag

Yes. Edit the summary-message.message section in config.yml. You can use any PlaceholderAPI placeholders, including PhantomDungeons summary placeholders, and color codes.

chevron-rightWhat happens if a player has no gains?hashtag

Summaries are automatically suppressed if a player has nothing to display (no gains tracked). This prevents spam and empty messages.

chevron-rightCan I track custom currencies?hashtag

Yes! Use any currency ID you want. As long as you have the corresponding placeholder configured (e.g., %phantomdungeons_summary_mycurrency_formatted%), it will display correctly.

chevron-rightIs there a way to clear all players' summary data at once?hashtag

Not directly through the API, but you can iterate through online players and call clearPlayerData() for each, or simply reload the plugin.


sack-dollarEconomy APIchevron-rightbottle-waterBoosters APIchevron-rightcodepenEnchants APIchevron-rightrectangle-terminalLevelling APIchevron-rightswordSword APIchevron-right

Last updated