Feather-only plugins
The API has two small helpers for deciding which servers your plugin runs on: FeatherPlugin, a base class, and FeatherSupport, static checks you can call from any plugin. Both detect FeatherMC with Paper’s own ServerBuildInfo brand check, so they give the right answer on FeatherMC and on plain Paper.
Feather-only plugins
Section titled “Feather-only plugins”Extend FeatherPlugin and put your logic in onFeatherEnable() and onFeatherDisable(). They replace onEnable() and onDisable(), which are final in this class. On a server that is not FeatherMC, the plugin logs a red message and disables itself instead of running.
import dev.feathermc.feather.FeatherPlugin;
public final class MyPlugin extends FeatherPlugin { @Override protected void onFeatherEnable() { getLogger().info("Enabled on FeatherMC!"); }}On Paper, the console shows this in red:
Plugin MyPlugin only supports Feather! You are currently running Paper version 1.21.1.
If you would rather not extend a base class, put this at the top of your own onEnable() for the same effect:
if (!FeatherSupport.requireFeather(this)) return;Plugins for FeatherMC and Paper
Section titled “Plugins for FeatherMC and Paper”Add allowPaper() to also run on Paper, with FeatherMC features kept Feather-only. See Supporting Paper too.
FeatherSupport
Section titled “FeatherSupport”| Method | Returns |
|---|---|
isFeather() | true on FeatherMC, false on Paper or any other server. |
serverType() | The brand name, such as FeatherMC or Paper. |
serverVersion() | The Minecraft version the server runs. |
requireFeather(Plugin) | true on FeatherMC. Otherwise it logs the red message, disables the plugin and returns false. |
unsupportedMessage(String) | The red “only supports Feather” message as an Adventure Component. |
Showing the message on Paper
Section titled “Showing the message on Paper”With the Shadow plugin:
tasks.shadowJar { // bundle only the stateless gate classes; everything else is provided by the server include("dev/feathermc/feather/FeatherSupport*.class") include("dev/feathermc/feather/FeatherPlugin*.class")}Do not bundle Feather, the events or the config classes. The FeatherMC server provides those at runtime, and shading them would break Feather.isAvailable().
Adapted from the PaperMC docs (CC BY-SA 4.0). About these docs.