Skip to content
Jan Kluka edited this page Sep 10, 2026 · 3 revisions

Addons

X-Warden loads addons from plugins/X-Warden/addons/. An addon is an ordinary jar with a few manifest lines: X-Warden finds it on startup, hands it a data folder, a logger and the API, and shuts it down cleanly when the server stops.

Addons are not plugins. They do not appear in /plugins, they do not need a plugin.yml, and they cannot be enabled before X-Warden — which is the point, because they can then use the API from their first line without guarding for its absence.

Installing one

  1. Drop the jar into plugins/X-Warden/addons/.
  2. Restart, or run /xwarden addons load <file>.jar.
  3. Check it with /xwarden addons.
/xwarden addons
Addons: 2
 - Dashboard v1.0.0 by Drawethree | running
 - Hello v1.0.0 by Drawethree | stopped
Command Does
/xwarden addons lists what is loaded, and whether it is running
/xwarden addons enable <name> starts one that is loaded but stopped
/xwarden addons disable <name> stops one without unloading it
/xwarden addons load <file>.jar loads a jar you have just dropped in, without a restart

All four need xwarden.admin.

Each addon gets its own folder — plugins/X-Warden/addons/<Addon Name>/ — for its config and data. Deleting the jar removes the addon; the folder stays, so its settings survive an upgrade.

When one does not load

X-Warden says why, by name, in the console. The usual reasons:

It says What happened
its manifest has no X-Warden-Addon-Class the jar is not an addon, or was built without the manifest entries
needs 'X', which is not available it declares a dependency on another addon you have not installed
is in a circular dependency two addons each declare they need the other
does not implement XWardenAddon the class named in the manifest is not an addon class
asks for X-Warden 1.2.0 and this is 1.0.0 it was built for a newer X-Warden. It still tries to load
needs the Adventure library the addon was built against Adventure and this server is Spigot. Run Paper, or ask the author to rebuild

One broken addon never stops the others, and it never stops X-Warden. An addon that throws while starting is disabled on its own and everything else carries on.

Writing one

The contract is in X-WardenAPI, which you compile against at provided scope — the same artifact the Developer API page covers.

public final class MyAddon implements XWardenAddon {

    @Override
    public void onEnable(XWardenAddonContext context) {
        XWardenAPI warden = context.getAPI();
        context.getLogger().info("Watching " + warden.getModulesApi().moduleIds());
    }

    @Override
    public void onDisable() {
        // stop anything you started
    }
}

Your jar's manifest:

X-Warden-Addon-Class: com.example.MyAddon
X-Warden-Addon-Name: MyAddon
X-Warden-Addon-Version: 1.0.0
X-Warden-Addon-Author: You
X-Warden-Addon-Description: What it is for
X-Warden-Min-Version: 1.0.0
X-Warden-Priority: 50
X-Warden-Depends: SomeOtherAddon

Only X-Warden-Addon-Class is required. X-Warden-Depends is a comma-separated list of addon names; anything it lists is guaranteed to have loaded and started first, and your addon is skipped if one of them is not installed. X-Warden-Priority orders addons that do not depend on each other — lower loads first, and 50 is the default.

With Maven, maven-jar-plugin writes those entries for you:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifestEntries>
                <X-Warden-Addon-Class>com.example.MyAddon</X-Warden-Addon-Class>
                <X-Warden-Addon-Name>MyAddon</X-Warden-Addon-Name>
                <X-Warden-Addon-Version>${project.version}</X-Warden-Addon-Version>
                <X-Warden-Addon-Author>You</X-Warden-Addon-Author>
            </manifestEntries>
        </archive>
    </configuration>
</plugin>

What the context gives you

getAPI() the full API, already published by the time onEnable runs
getDataFolder() a folder of your own, created for you
getLogger() a logger that says which addon a line came from
registerEvents(listener) a Bukkit listener that is unregistered when you are disabled
getPlugin() X-Warden itself, for the few APIs that insist on a Plugin
call(callable) / sync(runnable) run something on the server thread and wait for it
async(runnable) run something off it; cancelled when you are disabled

call is what you need whenever you are working on a thread of your own — a web request, a socket, a scheduled job — and have to touch the server to answer it. It never waits forever: on a shutting-down server it throws WardenSyncException rather than parking your thread permanently.

Stopping cleanly

Listeners and tasks registered through the context are released for you. Anything else you started is yours to stop in onDisable — a thread, a socket, an HTTP server. X-Warden closes your classloader once onDisable returns, and a thread still running against a closed classloader keeps the whole addon alive and fails in ways nothing will explain. X-Warden names any it finds, so watch the console after a reload.

onDisable is given a bounded amount of time. An addon that hangs there is reported and left behind rather than being allowed to hang the server's shutdown.

Clone this wiki locally