And finally we want to listen to the CustomPortalIgniteEvent so we can summon the explosion particles. We use the EventHandler like we would in any other case.
@EventHandler(ignoreCancelled =true, priority =EventPriority.NORMAL)publicvoidpostPortalIgnite(CustomPortalIgniteEvent e) {//We check if the entity is a player, if its not we skip//If the player does not have permission, we also skipif (!(e.getEntity() instanceof Player) ||!e.getEntity().hasPermission("dimensions.exampleaddon.explosion")) return;//Everything looks fine so we summon the explosionCompletePortal complete =e.getCompletePortal(); //We get the complete portalLocation location =complete.getCenter(); //We get the center of the portal//We summon the particleslocation.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, location,5);}
Finishing up
Now that we are done with coding, we have to let Dimensions know about our addon otherwise its not going to load it.
You need to create a few folders and files inside our src folder.
src
└───main
└───java
└───META-INF
└───services
Inside the services folder we need to create a new file named: