Interface Listener


public interface Listener
A marker interface used to discover and register event listener classes within the EventHandler.

Classes implementing this interface serve as containers for methods annotated with EventListener. For a method to be successfully registered as an active subscriber, it must satisfy the following criteria:

  • The enclosing class must implement this Listener interface.
  • The method must be annotated with EventListener.
  • The method must be public and non-static.
  • The method must accept exactly one parameter which inherits from the Event class.

Example Usage:


 public class MyListener implements Listener {

     @EventListener(priority = EventPriority.HIGH)
     public void onModelLoaded(ModelLoadedEvent event) {
         // Handle the event here
     }
 }
 
See Also: