> For the complete documentation index, see [llms.txt](https://kynosdeveloping.gitbook.io/kynosdeveloping/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kynosdeveloping.gitbook.io/kynosdeveloping/kynoslib/cooldown-system.md).

# 📄 Cooldown System

The `CooldownManager` provides a high-performance, thread-safe runtime caching layout to handle player action throttling across the framework ecosystem.

#### ✨ Key Features

* 💾 **Memory Efficient**: Automatically cleans up expired timestamps on lookup checks to maintain a low memory footprint.
* 🗣️ **Config-Driven Alerts**: Reads directly from `Messages.CooldownActive` with dynamic floating-point parsing (`%.1fs`) to show the remaining time.

#### 💡 Implementation Example

```java
public class SpecialAbility {

    public void execute(Player player) {
        // Cooldown duration defined in milliseconds (e.g., 5000ms = 5 seconds)
        long cooldownTime = 5000L;
        String trackingKey = "special_ability_use";

        // Check and set automatically flags the player and alerts them if on cooldown
        if (!CooldownManager.checkAndSet(player, trackingKey, cooldownTime)) {
            return; // Exit execution if the cooldown is currently active
        }

        // Proceed with your plugin logic if validation passes
        player.sendMessage("§aYou successfully activated your special ability!");
    }
}
```

```
// Check if a player has an active cooldown tracker silently
boolean active = CooldownManager.hasCooldown(player.getName(), "special_ability_use");

// Manually clear or bypass a cooldown tracker for a specific player
CooldownManager.remove(player.getName(), "special_ability_use");
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kynosdeveloping.gitbook.io/kynosdeveloping/kynoslib/cooldown-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
