# Developer API

### 1) Add the Dependency

Don't forget to change always the version!

<div align="left"><figure><img src="https://img.shields.io/maven-metadata/v.svg?label=CreditsAPI&#x26;metadataUrl=https://repo.mongenscave.com/releases/com/mongenscave/mc-CreditsAPI/maven-metadata.xml" alt=""><figcaption></figcaption></figure></div>

{% tabs %}
{% tab title="Maven" %}

<pre class="language-xml" data-full-width="true"><code class="lang-xml"><strong>&#x3C;repository>
</strong>  &#x3C;id>MonGens-Cave&#x3C;/id>
  &#x3C;url>https://repo.mongenscave.com/releases&#x3C;repository>&#x3C;/url>
&#x3C;/repository>

&#x3C;dependency>
  &#x3C;groupId>com.mongenscave&#x3C;/groupId>
  &#x3C;artifactId>mc-CreditsAPI&#x3C;/artifactId>
  &#x3C;version>[VERSION]&#x3C;/version>
&#x3C;/dependency>
</code></pre>

{% endtab %}

{% tab title="Gradle" %}

```groovy
maven { url "https://repo.mongenscave.com/releases" }

implementation "com.mongenscave:mc-CreditsAPI:[VERSION]"
```

{% endtab %}
{% endtabs %}

### 2) Add mc-Credits to plugin.yml

{% tabs %}
{% tab title="as depend" %}

```yaml
depend:
  - mc-Credits
```

{% endtab %}

{% tab title="as softdepend" %}

```yaml
softdepend:
  - mc-Credits
```

{% endtab %}
{% endtabs %}

### 3) Example how to use the CreditsAPI

As an example, add Credit to a player.

```java
public class CreditExemple {
   public void giveCredit(Player player, int amount){
       CreditUtil.addCredits(player, amount);
   }
}
```

| Event             | Description                                               |
| ----------------- | --------------------------------------------------------- |
| CreditChangeEvent | Triggered when a player's credit balance is modified.     |
| PlayerBoughtEvent | Triggered when a player buys anything in the credit shop. |
