Using the API in a plugin
Every Paper plugin already depends on the Paper API. Add feather-api next to it. Both are compileOnly, because the running server provides them.
Dependencies
Section titled “Dependencies”repositories { mavenCentral() maven("https://repo.papermc.io/repository/maven-public/")}
dependencies { compileOnly("io.papermc.paper:paper-api:26.3.build.+") compileOnly("io.github.1chenyip:feather-api:26.3.0")}
java { toolchain.languageVersion.set(JavaLanguageVersion.of(25))}<dependency> <groupId>io.papermc.paper</groupId> <artifactId>paper-api</artifactId> <version>[26.3.build,)</version> <scope>provided</scope></dependency><dependency> <groupId>io.github.1chenyip</groupId> <artifactId>feather-api</artifactId> <version>26.3.0</version> <scope>provided</scope></dependency>The Paper API version matches the Minecraft version you target. These examples use the latest. The first part of the feather-api version follows the Minecraft version, and the last number counts releases for it, so 26.3.1 would follow 26.3.0. Paper’s project setup guide covers the rest of a plugin build.
Example
Section titled “Example”FeatherMC plugins extend FeatherPlugin. This plugin escalates the built-in autoclicker check to a kick, never for staff. On a server that is not FeatherMC it disables itself with a clear message:
package com.example;
import dev.feathermc.feather.Feather;import dev.feathermc.feather.FeatherPlugin;import dev.feathermc.feather.config.AntiCheatAction;import dev.feathermc.feather.event.AntiCheatFlagEvent;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;
public final class ExamplePlugin extends FeatherPlugin implements Listener {
@Override protected void onFeatherEnable() { getLogger().info("Running on " + Feather.brandName() + " " + Feather.version()); getServer().getPluginManager().registerEvents(this, this); }
@EventHandler public void onFlag(final AntiCheatFlagEvent event) { if (event.getPlayer().hasPermission("example.bypass")) { event.setCancelled(true); return; } if (event.getMeasuredCps() > 30) { event.setAction(AntiCheatAction.KICK); } }}Put your enable and disable logic in onFeatherEnable() and onFeatherDisable(). See Feather-only plugins for how the check works, how to show the message on Paper, and how to also allow Paper.
Adapted from the PaperMC docs (CC BY-SA 4.0). About these docs.