Wale
  • Welcome!
  • General
    • Getting Started
    • Requirements
    • Detailed plan overview
    • FAQ
  • Wale Documentation
    • Installation
    • Master Configuration
    • Templates
    • Nodes
    • Teams
  • API Documentation
    • Getting Started
    • Events
      • Node Notification
      • Service Notification
      • Network Full
      • Channel Message
    • Listener
    • Executors
      • Channel Executor
      • Player Executor
      • Service Executor
  • Getting Support
    • Discord
    • Tickets
Powered by GitBook
On this page
  • How do I create a listener?
  • How do I register a listener?
  1. API Documentation

Listener

Here we explain and demonstrate how you can create and register listeners for Wale events.

How do I create a listener?

public class YourListenerName implements EventListener {

    // The @Eventable annoation must be used
    @Eventable
    public void handle(ChannelMessageEvent event) {
        // Handle the event
    }
}

How do I register a listener?

We recommend registering the listeners when loading the plugins.

Attention: Your plugin must be loaded after the Wale plugin if you are using events or the API when loading your plugin. Here is an example for the plugin.yml and bungee.yml

# spigot.yml or bungee.yml (same method)
depend:
  - Wale
public class Test extends JavaPlugin {
    
    @Override
    public void onEnable() {
        EventDispatcher.addListener(new ListenerWale());
    }
}
public class Test extends Plugin {
    
    @Override
    public void onEnable() {
        EventDispatcher.addListener(new YourListenerName());
    }
}
PreviousChannel MessageNextExecutors

Last updated 1 year ago