> For the complete documentation index, see [llms.txt](https://edseries-plugins.gitbook.io/p/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://edseries-plugins.gitbook.io/p/pinnaprison/developers/introduction.md).

# Developer API

PinnaPrison ships a clean, stable developer API in the `es.edwardbelt.pinnaprison.iapi` package — a set of **services** (one per feature), a set of Bukkit **events**, and hooks for **registering your own content** (e.g. custom enchants).

## Getting the API

1. Add PinnaPrison to your `plugin.yml` so it loads first:

```yaml
depend: [PinnaPrison]        # or softdepend if it's optional
```

2. Add the PinnaPrison jar to your build (provided scope) so you can compile against `iapi`.
3. Grab the instance once PinnaPrison has enabled (e.g. in your `onEnable`):

```java
import es.edwardbelt.pinnaprison.iapi.PinnaPrisonAPI;

PinnaPrisonAPI api = PinnaPrisonAPI.getInstance();
if (api == null) {
    getLogger().warning("PinnaPrison isn't loaded!");
    return;
}
api.getCurrencies().addBalance(uuid, "tokens", java.math.BigDecimal.TEN);
```

`PinnaPrisonAPI.getInstance()` returns `null` until PinnaPrison finishes enabling — the `depend` above guarantees that's done by your `onEnable`.

## Services

Every feature has a service, reached from the API instance:

| Getter            | Service                                                                   |
| ----------------- | ------------------------------------------------------------------------- |
| `getCurrencies()` | `CurrencyService` — balances, give/take, boosted income                   |
| `getLeveling()`   | `LevelingService` — levels, give/take                                     |
| `getEnchants()`   | `EnchantService` — levels, chance, prestige, **register custom enchants** |
| `getPickaxe()`    | `PickaxeService`                                                          |
| `getMines()`      | `MineService` — mine bounds, **break blocks/layers**                      |
| `getBackpacks()`  | `BackpackService`                                                         |
| `getBoosters()`   | `BoosterService`                                                          |
| `getCrystals()`   | `CrystalService`                                                          |
| `getRebirth()`    | `RebirthService`                                                          |
| `getAttributes()` | `AttributeService`                                                        |
| `getAbilities()`  | `AbilityService`                                                          |
| `getAutominers()` | `AutominerService`                                                        |
| `getSell()`       | `SellService`                                                             |
| `getBombs()`      | `BombService`                                                             |
| `getDrills()`     | `DrillService`                                                            |

All service calls are thread-safe.

## Events

Reactive hooks live in `es.edwardbelt.pinnaprison.iapi.event` as standard Bukkit events — register a normal `Listener`. Some fire **asynchronously** (the mining/break path), so treat them like async events (don't touch the Bukkit world directly from them). Examples:

| Event                                                                                        | Fired when                                          |
| -------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| `BlockMineEvent`                                                                             | a player mines a mine block (cancellable)           |
| `BlocksBrokenEvent`                                                                          | a batch of blocks is broken (bombs/drills/enchants) |
| `EnchantProcEvent`                                                                           | an enchant procs (cancellable)                      |
| `EnchantPrestigeEvent`                                                                       | an enchant is prestiged                             |
| `CurrencyChangeEvent`                                                                        | a balance changes                                   |
| `LevelUpEvent`                                                                               | a leveling track levels up                          |
| `PlayerRebirthEvent`                                                                         | a player rebirths                                   |
| `BombThrowEvent` / `BombExplodeEvent`                                                        | a bomb is thrown / explodes                         |
| `DrillUseEvent` / `DrillFinishEvent`                                                         | a drill is used / finishes                          |
| `BackpackSellEvent`, `BoosterActivateEvent`, `AbilityActivateEvent`, `PrivateMineResetEvent` | …                                                   |

## Next

* [Enchant API](/p/pinnaprison/developers/enchant-api.md) — create your own custom enchants.
* [EdLib API](/p/pinnaprison/developers/edlib-api.md) — the packet/NMS layer underneath: spawn client-only entities, models and fake blocks, and [animate them over a mine](/p/pinnaprison/developers/edlib-api/mine-entities.md) like the built-in enchants.


---

# 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://edseries-plugins.gitbook.io/p/pinnaprison/developers/introduction.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.
