# Developer Overview Chain provides a public API module (`Chain-API`) that allows other plugins to chain and unchain entities programmatically, query chain state, and adjust the maximum chain distance. --- ## Maven / Gradle The Chain-API artifact is `gg.lode.chainapi` (v1.0.2). Add it as a `compileOnly` dependency so that Chain is not shaded into your plugin jar. **Gradle (Kotlin DSL):** ```kotlin compileOnly("gg.lode:chain-api:1.0.2") ``` **Maven:** ```xml <dependency> <groupId>gg.lode</groupId> <artifactId>chain-api</artifactId> <version>1.0.2</version> <scope>provided</scope> </dependency> ``` Add `Chain` as a `depend` or `softdepend` in your `plugin.yml`: ```yaml softdepend: - Chain ``` --- ## Accessing the API The API is accessed through the static `ChainAPI` class. The API instance is available after Chain has been enabled. ```java import gg.lode.chainapi.ChainAPI; import gg.lode.chainapi.IChainAPI; IChainAPI api = ChainAPI.getApi(); if (api == null) { // Chain is not loaded return; } ``` --- ## Common Operations ### Chain two entities ```java IChainManager manager = api.getChainManager(); manager.chain(playerA, playerB); ``` ### Check if an entity is chained ```java boolean chained = manager.isChained(player); boolean chainedTogether = manager.isChainedWith(entityA, entityB); ``` ### Unchain an entity ```java manager.unchain(player); ``` ### Adjust max distance ```java api.setMaxDistance(5); int current = api.getMaxDistance(); ``` --- ## Architecture | Module | Description | |---|---| | **Chain-API** | Public interfaces. Depend on this module. | | **Chain-Paper** | Implementation. Contains commands, chain tick logic, event handlers, and fake leash management. Do not depend on this directly. | The API entry point is `ChainAPI.getApi()`, which returns an `IChainAPI` instance. From there, access `IChainManager` for all chain operations. --- ## Related Pages - [[Chain/Developers/API Reference]] — Full interface documentation - [[Lead/Server Owners/Overview]] — Plugin overview and installation - [[Lead/Server Owners/Commands]] — Command reference