> 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/service.md).

# The ClickEmAPI service

Every method of the ClickEmAPI service, grouped by area.

Class: `com.lethiumstore.clickem.api.ClickEmAPI`. Get it with `ClickEmAPI.get()`. See [Developer API](/lethium-docs/dev-api.md).

### General

| Method                               | Returns                                                                                                    |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| `static ClickEmAPI get()`            | The service. Throws if ClickEm is not enabled.                                                             |
| `static final int VERSION`           | The API version (2).                                                                                       |
| `boolean isModuleEnabled(String id)` | Whether a module is on. Ids are listed in [Modules](/lethium-docs/configuration/modules.md).               |
| `String language(Player player)`     | The player's language as a lower-case locale such as `de_de`. Already limited to languages on the licence. |

### Currency

The primary currency is **Coins** (`coins`). Other currency ids: `gems`, `artifact_essence`.

| Method                                                     | What it does                              |
| ---------------------------------------------------------- | ----------------------------------------- |
| `String primaryCurrency()`                                 | The primary currency id.                  |
| `double balance(Player)`                                   | Balance in the primary currency.          |
| `double balance(Player, String currency)`                  | Balance in any currency.                  |
| `void deposit(Player, String currency, double amount)`     | Add.                                      |
| `boolean withdraw(Player, String currency, double amount)` | Remove. `false` if they cannot afford it. |
| `void setBalance(Player, String currency, double amount)`  | Set.                                      |

Changes fire `CurrencyChangeEvent` (cancellable, main thread).

### Stats

| Method                                                      | What it does                                                                     |
| ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `StatBlock stats(Player)`                                   | The player's combined stat stack.                                                |
| `double stat(Player, StatType)`                             | One stat as a percent.                                                           |
| `void addStatContributor(Plugin owner, StatContributor)`    | Add a stat source. See [Stats and contributors](/lethium-docs/dev-api/stats.md). |
| `void removeStatContributor(Plugin owner, StatContributor)` | Remove it.                                                                       |

Contributors are removed automatically when the owner plugin is disabled.

### Profile Level

| Method                                              | What it does                    |
| --------------------------------------------------- | ------------------------------- |
| `int level(Player)`                                 | Level (0 if the module is off). |
| `double xp(Player)`                                 | Total lifetime XP.              |
| `void giveXp(Player, double amount, String source)` | Add XP. Fires `ProfileXpEvent`. |

### Rebirth

| Method                       | What it does                        |
| ---------------------------- | ----------------------------------- |
| `int rebirths(Player)`       | Rebirth count.                      |
| `boolean canRebirth(Player)` | Whether all requirements are met.   |
| `boolean rebirth(Player)`    | Performs it. `true` if it happened. |

### Zones

| Method                                  | What it does                                |
| --------------------------------------- | ------------------------------------------- |
| `Set<String> zoneIds()`                 | Every zone id.                              |
| `Optional<Zone> zone(String id)`        | A zone.                                     |
| `Optional<Zone> currentZone(Player)`    | The zone the player is standing in.         |
| `Set<String> unlockedZones(Player)`     | Zones they own.                             |
| `boolean hasZone(Player, String id)`    | Whether they own one.                       |
| `boolean grantZone(Player, String id)`  | Unlock. `false` if the zone does not exist. |
| `boolean revokeZone(Player, String id)` | Re-lock.                                    |

`Zone` is a record: `id()`, `world()`, `regionIds()`, `displayName()`, `minCurrency()`, `minRebirth()`, `minLevel()`, `requiredZone()`, `allowedMobs()`, `requiredPermission()`, `requiredAchievement()`, `rebirthKills()` and `rebirthEssence()`. `label()` gives the display name, or the id if none is set, and `allowsMob(String)` checks the allowed list.

### Pets

| Method                                         | What it does                                                   |
| ---------------------------------------------- | -------------------------------------------------------------- |
| `int petCount(Player)`                         | Pets owned.                                                    |
| `List<String> petIds(Player)`                  | Ids of owned pets.                                             |
| `boolean givePet(Player, String definitionId)` | Grant a pet (a file id such as `Z1_1`). Fires `PetGrantEvent`. |

### Mobs

| Method                                                                                                     | What it does                                   |
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| `boolean isClickEmMob(LivingEntity)`                                                                       | Whether ClickEm spawned it.                    |
| `Optional<String> mobType(LivingEntity)`                                                                   | Its MythicMobs id.                             |
| `Optional<String> mobDisplayName(String mobType)`                                                          | The friendly name (`Oak Whelp`).               |
| `Optional<LivingEntity> spawnMob(String mobType, Location, int level, String zoneId, String spawnPointId)` | Spawn a ClickEm mob. Fires `MobPreSpawnEvent`. |
| `Optional<String> mobAffix(LivingEntity)`                                                                  | The affix id (`armored`, `lucky` ...).         |
| `double mobRewardMultiplier(LivingEntity)` and `void setMobRewardMultiplier(LivingEntity, double)`         | The payout multiplier of one mob.              |
| `double mobDamageReduction(LivingEntity)` and `void setMobDamageReduction(LivingEntity, double percent)`   | Percent of each hit ignored. Capped at 95.     |
| `double mobDropBonus(LivingEntity)` and `void setMobDropBonus(LivingEntity, double percent)`               | Extra Echo and fragment chance for this kill.  |

These three values are stored on the entity, so they can be set right after `MobPreSpawnEvent` or after `spawnMob`.

### Not hooked yet

These have no API or event yet: cancelling a pet grant (use the returned instance), buying cosmetics, buying VIP, and learning or levelling abilities.


---

# 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/service.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.
