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

# Events

The full catalog of ClickEm events, what each one carries, and which values you can change.

All events are in `com.lethiumstore.clickem.api.event` and extend Bukkit's `Event`. Listen with a normal `@EventHandler`.

| Legend          | Meaning                                                                               |
| --------------- | ------------------------------------------------------------------------------------- |
| **Cancellable** | Call `event.setCancelled(true)` to stop the action. It happens **before** the action. |
| **Mutable**     | A setter lets you change a value (a price, an amount, damage).                        |
| **Notify**      | Fires **after** something happened. You cannot change it.                             |

All accessors are written `event.player()`, `event.amount()`, not `getPlayer()`.

### Economy and rewards

| Event                   | Cancel | Data                                                                     | Mutable     |
| ----------------------- | ------ | ------------------------------------------------------------------------ | ----------- |
| `CurrencyRewardEvent`   | yes    | `player`, `currency`, `amount`, `mob`, `share` (the damage-share 0 to 1) | `setAmount` |
| `CurrencyChangeEvent`   | yes    | `player`, `currency`, `amount`, `withdrawal`                             | `setAmount` |
| `DailyRewardClaimEvent` | yes    | `player`, `day`, `coins`                                                 | `setCoins`  |
| `KillstreakRewardEvent` | yes    | `player`, `streak`                                                       |             |
| `CodeRedeemEvent`       | yes    | `player`, `code`                                                         |             |
| `QuestClaimEvent`       | yes    | `player`, `questId`                                                      |             |
| `AchievementClaimEvent` | yes    | `player`, `achievementId`                                                |             |
| `SeasonPassClaimEvent`  | yes    | `player`, `level`, `premium`                                             |             |
| `ProfileXpEvent`        | yes    | `player`, `amount`, `source`                                             | `setAmount` |
| `SkillXpEvent`          | yes    | `player`, `skillId`, `amount`                                            | `setAmount` |

* `CurrencyRewardEvent` fires for **each kill payout**. `share` is the damage-share factor already applied to `amount`.
* `CurrencyChangeEvent` fires for every balance change through the economy service. It fires on the **main thread**. Keep handlers short.

### Progression

| Event                  | Cancel | Data                                                         | Mutable   |
| ---------------------- | ------ | ------------------------------------------------------------ | --------- |
| `ZonePurchaseEvent`    | yes    | `player`, `zoneId`, `cost`                                   | `setCost` |
| `ZoneEnterEvent`       | notify | `player`, `zoneId`                                           |           |
| `ZoneLeaveEvent`       | notify | `player`, `zoneId`                                           |           |
| `RebirthEvent`         | yes    | `player`, `nextCount`                                        |           |
| `PostRebirthEvent`     | notify | `player`, `count`                                            |           |
| `UpgradePurchaseEvent` | yes    | `player`, `upgradeId`, `levels`, `cost`                      | `setCost` |
| `ArtifactUpgradeEvent` | yes    | `player`, `artifactId`, `levels`, `cost`                     | `setCost` |
| `GearUpgradeEvent`     | yes    | `player`, `slotId`                                           |           |
| `BoostActivateEvent`   | yes    | `player`, `boostId`                                          |           |
| `AbilityPreCastEvent`  | yes    | `player`, `ability` (`AbilityDefinition`), `level`, `target` |           |

### Combat

| Event                  | Cancel | Data                                                           | Mutable     |
| ---------------------- | ------ | -------------------------------------------------------------- | ----------- |
| `PlayerDamageMobEvent` | yes    | `player`, `mob`, `damage`, `critical`, `manualClick`           | `setDamage` |
| `MobDamagePlayerEvent` | yes    | `player`, `mob`, `damage`                                      | `setDamage` |
| `MobPreSpawnEvent`     | yes    | `mob` (type id), `location`, `level`, `zoneId`, `spawnPointId` | `setLevel`  |
| `StatCalculateEvent`   | notify | `player`, `stats`                                              | `setStats`  |

* `PlayerDamageMobEvent.manualClick()` is `true` for a player's own click and `false` for auto-attack. The `damage` is final damage after every stat. Cancelling makes the hit do nothing.
* `MobDamagePlayerEvent` only fires for **bosses** (regular mobs never hit players).
* `MobPreSpawnEvent` fires before a spawn pad (or `api.spawnMob`) spawns a mob. Cancel it to skip the spawn.
* `StatCalculateEvent`: see [Stats and contributors](/lethium-docs/dev-api/stats.md).

### Pets and eggs

| Event              | Cancel | Data                               | Mutable     |
| ------------------ | ------ | ---------------------------------- | ----------- |
| `EggHatchEvent`    | yes    | `player`, `eggId`, `count`, `cost` | `setCost`   |
| `PetGrantEvent`    | notify | `player`, `pet` (`PetInstance`)    |             |
| `PetEquipEvent`    | yes    | `player`, `pet`                    |             |
| `PetFuseEvent`     | yes    | `player`, `pet`                    |             |
| `PetPrestigeEvent` | yes    | `player`, `pet`                    |             |
| `PetSellEvent`     | yes    | `player`, `pet`, `value`           | `setValue`  |
| `PetXpEvent`       | yes    | `player`, `pet`, `amount`          | `setAmount` |
| `PetLevelUpEvent`  | notify | `player`, `pet`, `level`           |             |
| `EchoDropEvent`    | yes    | `player`, `mob`, `zoneId`          |             |
| `EchoSalvageEvent` | yes    | `player`                           |             |
| `BossLootEvent`    | yes    | `player`, `boss`                   |             |

`PetInstance` is one owned copy of a pet. It exposes its instance id, definition id (for example `Z1_1`), level, XP, prestige, variant, locked flag, enhancement level and grade.

### Social and economy

| Event                | Cancel | Data                                    | Mutable     |
| -------------------- | ------ | --------------------------------------- | ----------- |
| `TradeEvent`         | yes    | `first`, `second`                       |             |
| `TradeCompleteEvent` | notify | `first`, `second`                       |             |
| `GiftAcceptEvent`    | yes    | `player`, `sender`                      |             |
| `AuctionListEvent`   | yes    | `player`, `price`, `currency`           | `setPrice`  |
| `AuctionBuyEvent`    | yes    | `player`, `seller`, `price`, `currency` |             |
| `ClanCreateEvent`    | yes    | `player`, `name`, `tag`                 |             |
| `ClanJoinEvent`      | yes    | `player`, `clanId`                      |             |
| `ClanBankEvent`      | yes    | `player`, `amount`, `deposit`           | (read only) |

### Example: read, change, cancel

```java
@EventHandler
public void onHit(PlayerDamageMobEvent event) {
    if (event.critical()) {
        event.setDamage(event.damage() * 1.1);
    }
}

@EventHandler(priority = EventPriority.HIGH)
public void onZoneBuy(ZonePurchaseEvent event) {
    if (event.zoneId().equals("w3_zona1") && !event.player().hasPermission("myserver.world3")) {
        event.setCancelled(true);
        event.player().sendMessage("World 3 is locked until launch day.");
    }
}
```

### Priorities and ordering

Use `EventPriority` as usual. To **override** other plugins' changes, use `HIGH` or `HIGHEST`. To **observe** the final result, use `MONITOR` and do not change the event.

If two plugins change the same value, the last one to run wins. Multiply rather than set when you can (`setAmount(event.amount() * 2)`), so changes from different plugins combine.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://lethium.gitbook.io/lethium-docs/dev-api/events.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
