Creating a listener

Creating and registering a listener to the server.‌

Creating the listener

To create a new listener, simply instantiate a new FluidListener declaring the event type and override the run() method:

new FluidListener<>(EVENT.class) {
    @Override
    public void run() {
        EVENT event = getData();
        //RUN SOMETHING
    }
};

Creating a group listener

Group listeners are used to create multiple listeners at once, however, you can't use the advanced utilities such as setting delays etc. To create a new group listener, instantiate a new FluidListener.Group and add your methods in like you would do in a standard class extending from Bukkit's Listener:

new FluidListener.Group() {
    @EventHandler
    public void(Event event) {
        //RUN SOMETHING
    }
    
    @EventHandler
    public void(AnotherEvent event) {
        //RUN SOMETHING
    }
};

Last updated

Was this helpful?