> For the complete documentation index, see [llms.txt](https://aglerr.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aglerr.gitbook.io/wiki/theonly-series/the-only-mobcoins/developer-api.md).

# Developer API

Check all custom events that are available on the plugin.

{% content-ref url="/pages/-McgnvVb84G5sozi3VHV" %}
[Custom Events](/wiki/theonly-series/the-only-mobcoins/developer-api/custom-events.md)
{% endcontent-ref %}

## Getting Player Data

Normally you will use this to modify/get player's mobcoins. Keep in mind, method **MobCoinsAPI#getPlayerData** is nullable, so you'll have to null-check it first for safety.

{% code title="Example Usage" %}

```java
public void modifyPlayerCoins(Player player){
    // Firstly we get the player data
    PlayerData playerData = MobCoinsAPI.getPlayerData();
    // Return if the player data is null
    if(playerData == null){
        // Print something into the console
        System.out.println("Modify Coins failed (reason: null player data)");
        return;
    }
    // Now we can modify anything on the player data
    // Adding coins to the player data
    playerData.addCoins(10.25);
    // Removing coins
    playerData.removeCoins(5.50);
    // See how much mobcoins does player have
    System.out.println(player.getName() + " has " + playerData.getCoinsFormatted() + " coins");
}
```

{% endcode %}

{% hint style="info" %}
[See the PlayerData class here.](https://github.com/aglerr/TheOnly-MobCoins/blob/master/src/main/java/me/aglerr/mobcoins/PlayerData.java)
{% endhint %}

{% hint style="info" %}
Feel free to contact us If you want something to be added to the plugin's API.
{% endhint %}


---

# 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, and the optional `goal` query parameter:

```
GET https://aglerr.gitbook.io/wiki/theonly-series/the-only-mobcoins/developer-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
