CustomPortalIgniteEvent and spawns explosion particles at the center of any portal ignited by a player who holds the dimensions.exampleaddon.explosion permission. The full source is available on GitHub.
The Complete Main Class
Below is the full implementation. Each section is explained after the code block.Code Walkthrough
Class declaration —extends DimensionsAddon implements Listener
Every addon must extend DimensionsAddon. Implementing Listener is optional but required whenever you want to handle Bukkit or Dimensions events directly in the same class.
Constructor — super(...)
The super(...) call registers the addon’s metadata with Dimensions. Pass in a unique name, the target version, a short description, and a priority. DimensionsAddonPriority.NORMAL is the right choice for most addons.
onEnable(Dimensions pl)
Dimensions calls this method when it activates your addon. Registering this as a listener here ensures your @EventHandler methods receive events. The pl parameter is the live Dimensions plugin instance — pass it to registerEvents so Bukkit ties the listener lifetime to the Dimensions plugin.
@EventHandler — postPortalIgnite
Setting ignoreCancelled = true means your handler is skipped if another addon or listener already cancelled the event — a good default that prevents double-triggering side effects. The guard at the top of the method exits early if the igniting entity is not a Player or if the player lacks the required permission, keeping the logic clean and safe. e.getCompletePortal() returns the physical portal in the world, and getCenter() gives you a Location to anchor the particle effect. DimensionsUtils.getParticle(...) is a Dimensions helper that resolves the correct particle name across different server versions.
ServiceLoader Registration File
After writing the main class, create the following file structure inside yoursrc directory so Dimensions can discover your addon:
The file name must be exactly
me.xxastaspastaxx.dimensions.addons.DimensionsAddon — no extension, no extra characters. This is how Java’s ServiceLoader locates service implementations at runtime.Deploying the Addon
Build your project into a JAR and place it in./plugins/Dimensions/Addons/. Restart the server and Dimensions will load your addon automatically.
