Skip to main content
Building a Dimensions addon is straightforward: you create a Java project, extend the DimensionsAddon base class, optionally listen for events, and tell Dimensions where to find your class through a ServiceLoader registration file. The steps below walk you through the full process from an empty project to a deployable JAR.
1

Create your project and add Dimensions to the build path

Create a new Java project in your IDE of choice. Download Dimensions.jar from the SpigotMC resource page and add it to your build path as a compile-only dependency — do not bundle it into your addon JAR.You will also need the Bukkit/Spigot API on your build path, since Dimensions itself depends on it.
2

Create your main class

Your main class must extend DimensionsAddon. If you want to listen to Dimensions events, also implement Listener.
import me.xxastaspastaxx.dimensions.addons.DimensionsAddon;
import me.xxastaspastaxx.dimensions.addons.DimensionsAddonPriority;

public class MyAddon extends DimensionsAddon {
    public MyAddon() {
        super("MyAddon", "1.0.0", "My addon description", DimensionsAddonPriority.NORMAL);
    }
}
The super(...) call accepts four arguments:
  • name — a unique display name for your addon.
  • version — the version string for your addon.
  • description — a short description shown in logs.
  • priority — controls load order relative to other addons (LOW, NORMAL, or HIGH).
3

Override onEnable to register your listener

Override onEnable to run setup logic when Dimensions activates your addon. If your class implements Listener, register it here so Bukkit routes events to your handlers.
@Override
public void onEnable(Dimensions pl) {
    Bukkit.getPluginManager().registerEvents(this, pl);
}
You can also override onLoad to check for optional dependencies, onDisable to clean up, and registerPortal to receive each portal’s config at load time.
4

Create the ServiceLoader registration file

Dimensions uses Java’s ServiceLoader to discover addons. You must create a specific file at the exact path below inside your src directory:
src/main/java/META-INF/services/
Inside the services folder, create a file named exactly:
me.xxastaspastaxx.dimensions.addons.DimensionsAddon
Open that file and enter the fully-qualified class name of your main class on a single line:
com.yourpackage.youraddon.MyAddon
The file name must match the service interface exactly — me.xxastaspastaxx.dimensions.addons.DimensionsAddon — or Dimensions will not find your addon. This is a requirement of the Java ServiceLoader specification, not a Dimensions convention.
5

Build your addon JAR and deploy it

Build your project into a JAR file, then place the JAR in your server’s addon directory:
./plugins/Dimensions/Addons/
Restart your server. Dimensions will load all JARs in that folder and activate any that contain a valid ServiceLoader registration.
See a fully working implementation in the Example Addon — it covers all of these steps with real event-handling code you can copy and adapt.