> For the complete documentation index, see [llms.txt](https://wiki-en.herrtechniker.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki-en.herrtechniker.eu/coinsapi/api.md).

# API

To integrate the CoinsAPI into your project, you can place the .jar file in the `recources` folder of your project and make this entry in the `pom.xml` under the dependencies:

{% code title="pom.xml" lineNumbers="true" %}

```xml
<dependency>
    <groupId>de.herrtechniker</groupId>
    <artifactId>CoinsAPI</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/CoinsAPI-1.0.0-SNAPSHOT-OBF.jar</systemPath>
</dependency>
```

{% endcode %}

## CoinsAPI

To see if the player is already entered in the database, you can check it with the following query.

```java
CoinsAPI().getAPI().isPlayerCoinsEntryExists(UUID uuid); //return boolean
```

Get the balance of a player.

<pre class="language-java"><code class="lang-java"><strong>CoinsAPI().getAPI().getCoins(UUID uuid); //return double
</strong></code></pre>

Set the account balance to a certain amount.

<pre class="language-java"><code class="lang-java"><strong>CoinsAPI().getAPI().setCoins(UUID uuid, double amount);
</strong></code></pre>

Remove a certain amount from a player's account.

<pre class="language-java"><code class="lang-java"><strong>CoinsAPI().getAPI().removeCoins(UUID uuid, double amount);
</strong></code></pre>

Add a certain amount to a player's account.

<pre class="language-java"><code class="lang-java"><strong>CoinsAPI().getAPI().addCoins(UUID uuid, double amount);
</strong></code></pre>

Reset a player's account balance.

```java
CoinsAPI().getAPI().resetCoins(UUID uuid);
```

Set a player's account balance to a certain amount.

```java
CoinsAPI().getAPI().resetCoins(UUID uuid, double amount);
```

Change a player's account balance to a certain amount.

```java
CoinsAPI().getAPI().changeCoins(UUID uuid, double amount);
```

## Namefetcher

{% hint style="info" %}
The name fetcher is a "module" that stores the name and the corresponding UUID of the player.
{% endhint %}

To check whether a player's entry already exists, do the following.

```java
LanguageAPI().getApi().isNamefetcherEntryExists(UUID uuid); // return boolean
```

To check whether a player's entry already exists, do the following.

```java
LanguageAPI().getApi().isNamefetcherEntryExists(String name); // return boolean
```

To make an entry in the Namefetcher for a player, do the following.

{% hint style="warning" %}
Please note that there should ideally only be one entry per player
{% endhint %}

```java
LanguageAPI().getApi().setNamefetcher(UUID uuid, String name);
```

To change a player's entry, for example if the player has changed their name, do the following.

```java
LanguageAPI().getApi().changeNamefetcher(UUID uuid, String name);
```

To get the name of a player based on the UUID, do the following.

```java
LanguageAPI().getApi().getName(UUID uuid); // return String
```

To get the UUID of a player by name, do the following.

{% code fullWidth="false" %}

```java
LanguageAPI().getApi().getUUID(String name); // return UUID
```

{% endcode %}
