Skip to main content

CooldownManager

xyz.refineryteam.refinerycore.api.cooldown.CooldownManager tracks arbitrary cooldowns keyed by (namespace, key, subject). The namespace is typically your plugin or feature name (e.g. "kits", "combat"), so two plugins can use the same subject/key without colliding.
The command framework already uses an internal CooldownManager for the @Cooldown annotation — you only need to use this class directly for cooldowns outside of commands (ability usage, kit claims, etc).
KitsManager.java
tryAcquire is the recommended entry point for most “can this action happen” checks, since it avoids a separate check-then-set race.

PersistentCooldownManager

xyz.refineryteam.refinerycore.api.cooldown.PersistentCooldownManager is a CooldownManager whose entries survive restarts, backed by a RefineryDatabase. Use it for kit/redemption/reward cooldowns where “relog or restart to skip the wait” would be exploitable. Reads are cached in memory after first load; writes go through to the database immediately (fire-and-forget async by default):
KitManager.java
The query API (isOnCooldown, remaining*, tryAcquire) is identical to CooldownManager, so switching an existing feature to persistent cooldowns is a one-line change plus the setup calls.

RefineryScheduler

xyz.refineryteam.refinerycore.api.scheduler.RefineryScheduler wraps Paper’s Folia-compatible region/entity/async schedulers behind a flat set of static methods, so plugin code doesn’t need to branch between the legacy BukkitScheduler and Folia’s region-based scheduler APIs.
EntityScheduler.java
Prefer RefineryScheduler over calling Bukkit.getScheduler() directly anywhere your plugin might run on Folia. Mixing the legacy BukkitScheduler with Folia’s region schedulers in the same plugin is a common source of IllegalStateExceptions on Folia servers.

TaskChain<T>

xyz.refineryteam.refinerycore.api.scheduler.TaskChain formalizes async→sync→async sequencing. Each step declares where it runs; the chain handles the thread hops so you stop hand-rolling runAsyncrunSync nesting:
PlayerLoader.java
The current value flows through the chain — each step transforms it (async(Supplier), sync(Function)) or consumes it without changing it (syncConsume, asyncConsume). Aborted chains short-circuit: no further steps run once abortIfNull/abortIf fires.