# API

The API allows developers to access registered collections and to progress collections for players. You can also register Custom reward types and reward auto-correctors.

## Add the API to your project

### Maven

If you are insist on using maven still for whatever reason, you might need to include Aikars ACF repo as well.

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

```markup
<repository>
    <id>auroramc</id>
    <url>https://repo.auroramc.gg/releases/</url>
</repository>
```

{% endcode %}

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

```markup
<dependency>
    <groupId>gg.auroramc</groupId>
    <artifactId>AuroraCollections</artifactId>
    <version>1.5.1</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>gg.auroramc</groupId>
    <artifactId>Aurora</artifactId>
    <version>2.1.6</version>
    <scope>provided</scope>
</dependency>
```

{% endcode %}

### Gradle (Groovy)

{% code title="build.gradle" %}

```gradle
repositories {
    maven {
        url "https://repo.auroramc.gg/releases/"
    }
}

dependencies {
    compileOnly 'gg.auroramc:Aurora:2.1.6'
    compileOnly 'gg.auroramc:AuroraCollections:1.5.1'
}
```

{% endcode %}

### Gradle (Kotlin)

{% code title="build.gradle.kts" %}

```gradle
repositories { 
    maven("https://repo.auroramc.gg/releases/")
}

dependencies { 
    compileOnly("gg.auroramc:Aurora:2.1.6")
    compileOnly("gg.auroramc:AuroraCollections:1.5.1")
}
```

{% endcode %}

## Get the API instance

```java
import gg.auroramc.collections.api.AuroraCollectionsProvider;
import gg.auroramc.collections.collection.CollectionManager;

CollectionManager manager = AuroraCollectionsProvider.getCollectionManager()
```

You can view how to add Custom rewards and correctors for them [here](https://app.gitbook.com/s/yLqIhaehpeU9S2b7Qdr7/api#add-custom-reward-types). Though you will need to register them through the `CollectionManager`.

## Progressing collections

This will progress all collections with the `block_loot`trigger with the given item.

```java
ItemStack myItem = ...;
TypeId typeId = AuroraAPI.getItemManager().resolveId(myItem);
int amount = myItem.getAmount();

manager.progressCollections(player, typeId, amount, Trigger.BLOCK_LOOT);
```
