Skip to content

Developer API

Ancientwebofficial edited this page Jul 16, 2026 · 1 revision

Developer API

DailyStreak exposes a public API for other plugins to read or modify streak data.

Getting the API instance

DailyStreakApi api = DailyStreakApiProvider.get();

Example: Reading a player's current streak

api.getCurrentStreak(player.getUniqueId()).thenAccept(streak -> {
    player.sendMessage("Current streak: " + streak);
});

Threading

All API methods that read or mutate persistent data return a CompletableFuture and are safe to call from the main thread — the plugin handles moving database/storage work off-thread internally. Don't block on the future with .get()/.join() on the main thread; use .thenAccept() or similar to handle the result asynchronously.

Adding DailyStreak as a Dependency

If DailyStreak is published to a repository (e.g. JitPack), add it to your pom.xml or build.gradle as a provided/compileOnly dependency, and declare a soft-depend in your plugin.yml:

softdepend: [DailyStreak]

Then guard your API usage in case DailyStreak isn't installed:

if (Bukkit.getPluginManager().getPlugin("DailyStreak") != null) {
    DailyStreakApi api = DailyStreakApiProvider.get();
    // ...
}

Questions

If you're building against the API and something's unclear or missing, open an issue — API requests from integrators are welcome.

Clone this wiki locally