> For the complete documentation index, see [llms.txt](https://docs.mantic.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mantic.dev/manticsets/developer-api.md).

# Developer API

`ManticSetsAPI` is the static entry point for third-party integrations. The API JAR is for compiling plugins; install the normal ManticSets plugin JAR on the server.

## Build dependency

Run `gradle compileJava` from the ManticSets project. The compile-time API JAR is generated at `target/ManticSets-1.1-api.jar`. The Gradle `test` and `build` tasks also generate it.

Copy the API JAR to your integration project's `libs` directory and add it as a compile-only dependency. Include Bukkit and ManticLib on the compile classpath:

```groovy
dependencies {
    compileOnly "org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT"
    compileOnly "com.github.Mantic-Development:ManticLib:1.0.54.0"
    compileOnly files("libs/ManticSets-1.1-api.jar")
}
```

Add the repositories used by those dependencies:

```groovy
repositories {
    maven {
        url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
    }
    maven {
        url = "https://jitpack.io"
    }
}
```

Declare ManticSets as a server dependency in your `plugin.yml`:

```yaml
depend: [ManticSets]
```

The API JAR retains public signatures and replaces method bodies with stubs. It targets Java 8 and does not bundle Bukkit or ManticLib. Do not shade it into your plugin or install it on the server.

## Find and inspect sets

```java
import me.fullpage.manticsets.api.ManticSetsAPI;
import me.fullpage.manticsets.utils.SetUtil;
import me.fullpage.manticsets.wrappers.ManticSet;
import org.bukkit.entity.Player;

import java.util.Collection;
import java.util.Optional;

public final class SetExample {
    public void inspect(Player player) {
        Collection<ManticSet> all = ManticSetsAPI.getSets();
        Optional<ManticSet> one = ManticSetsAPI.getSet("warrior");
        Optional<ManticSet> active = ManticSetsAPI.getActiveSet(player);
        SetUtil.SetUtilInfo equipment = ManticSetsAPI.getEquipmentInfo(player);
    }
}
```

Set IDs are case-insensitive. Before ManticSets loads its set data, `getSets()` returns an empty collection and `getSet(id)` returns `Optional.empty()`. `getActiveSet()` returns a set only when its configured activation rule is met. Equipment info reports the set in each armor slot; empty slots and ordinary armor return `null`. `ManticSetsAPI.getSetFromItem(item)` identifies tagged armor pieces or enchanted books and returns `null` for other items.

## Listen for equipment events

```java
import me.fullpage.manticsets.api.events.ManticSetEquipEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public final class SetListener implements Listener {
    @EventHandler
    public void onSetEquip(ManticSetEquipEvent event) {
        if (event.getType() == ManticSetEquipEvent.EquipType.EQUIP) {
            String setId = event.getManticSet().getId();
        }
    }
}
```

The event provides `getPlayer()`, `getManticSet()`, and `getType()`. Types are `JOIN`, `QUIT`, `DEATH`, `EQUIP`, and `UNEQUIP`.
