# 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](/auroralevels/api.md#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);
```


---

# Agent Instructions: 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:

```
GET https://docs.auroramc.gg/auroracollections/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
