> For the complete documentation index, see [llms.txt](https://docs.mantic.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mantic.dev/reclaim/developer-api.md). Agents can also search and read this documentation through its [MCP server](https://docs.mantic.dev/~gitbook/mcp).

# Developer API

Reclaim exposes a Java API and Bukkit events for plugins that need to inspect redemption state or participate in claim processing.

## Access the API

Compile against the Reclaim API classes and load your integration after Reclaim. Add this runtime dependency to your plugin's `plugin.yml`:

```yaml
depend: [Reclaim]
```

After Reclaim has enabled, obtain its API from the plugin instance:

```java
import dev.mantic.reclaim.Reclaim;
import dev.mantic.reclaim.api.ReclaimAPI;

ReclaimAPI api = Reclaim.get().getApi();
```

## API methods

| Method                                                        | Purpose                                                                                                    |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `getAvailableReclaims(Player)`                                | Get base ranks the player can redeem, considering permissions, prior redemption, and the priority setting. |
| `hasRedeemed(UUID, String)`                                   | Check whether a base rank ID has been redeemed.                                                            |
| `markRedeemed(UUID, String)` / `unmarkRedeemed(UUID, String)` | Add or remove a base-rank redemption record and save the player data.                                      |
| `resetPlayer(UUID)`                                           | Remove all redemption records for one player and save.                                                     |
| `hasRedeemedCustomClaim(UUID, String)`                        | Check a custom claim redemption by claim ID.                                                               |
| `getCustomClaim(String)`                                      | Get a loaded custom claim by ID; returns `null` when the ID is not loaded.                                 |
| `reload()`                                                    | Reload configuration and custom claims.                                                                    |

For base-rank methods, use the lowercased configured rank name as its ID (for example, `VIP` becomes `vip`). Custom-claim methods use the lowercase claim file ID.

## Events

| Event                                        | Use                                                                                              |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `ReclaimPreProcessEvent`                     | Cancellable event before a player's base-rank redemption is processed.                           |
| `ReclaimUsedEvent`                           | Cancellable per-rank event; exposes the player and rank.                                         |
| `CustomClaimPreProcessEvent`                 | Cancellable event before a custom claim is processed.                                            |
| `CustomClaimUsedEvent`                       | Cancellable event before the custom claim is recorded and its commands run.                      |
| `ReclaimResetEvent` / `ReclaimAllResetEvent` | Fired after an individual or global reset.                                                       |
| `ReclaimReloadEvent`                         | Fired after configuration and custom claims reload.                                              |
| `MPlayerLoadEvent` / `MPlayerSaveEvent`      | Player redemption data load and save hooks; each event provides the UUID and player data object. |

For example, cancel the base reclaim flow before it processes any ranks:

```java
@EventHandler
public void onReclaim(ReclaimPreProcessEvent event) {
    if (shouldBlock(event.getPlayer())) {
        event.setCancelled(true);
    }
}
```

The `ReclaimPreProcessEvent`, `ReclaimUsedEvent`, `CustomClaimPreProcessEvent`, and `CustomClaimUsedEvent` events are cancellable.
