# Listener

### How do I create a listener?

```java
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.

{% hint style="warning" %}
**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 p*lugin.ym*l and *bungee.yml*

```yaml
# spigot.yml or bungee.yml (same method)
depend:
  - Wale
```

{% endhint %}

{% tabs %}
{% tab title="Spigot" %}

```java
public class Test extends JavaPlugin {
    
    @Override
    public void onEnable() {
        EventDispatcher.addListener(new ListenerWale());
    }
}
```

{% endtab %}

{% tab title="BungeeCord" %}

```java
public class Test extends Plugin {
    
    @Override
    public void onEnable() {
        EventDispatcher.addListener(new YourListenerName());
    }
}
```

{% endtab %}
{% endtabs %}
