Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Listener Priorities

Angel Avila edited this page Aug 5, 2020 · 13 revisions

Every plugin gets a say in what happens, and every plugin must get a chance to know the outcome of an event. So, we pass events to plugins even after they've been cancelled. A plugin can actually uncancel an event after another plugin cancelled it. This is where priorities become really important.

There are six priorities in Bukkit that are called in the following order

  1. LOWEST
  2. LOW
  3. NORMAL
  4. HIGH
  5. HIGHEST
  6. MONITOR

Let's say a BLOCK_PLACE event is being handled. The lowest priority listener is called to get its say in whether it should be cancelled or not. Then the low priority listener is called to see if it wants to override the lowest, etc. Eventually it hits monitor, and at this point nothing should change the outcome of the event. Monitor should be used to see the outcome of an event, without changing any aspect of it.

If we have three plugins enabled; one is a basic area protection plugin, one is a fancy plugin using signs, and another is a logging plugin. The protection plugin listens on Priority.LOWEST. It says they can't place blocks in this area, and cancels the event. The fancy sign plugin listens on Priority.NORMAL. It says they can place signs here, and uncancels the event. The log plugin listens on Priority.MONITOR. It sees that the event was actually allowed, and logs it.

Source:

Event API Reference, fetched 09.04.2017 from http://bukkit.gamepedia.com/Event_API_Reference#Event_Priorities

Issues With Other Plugins & How to Fix Them

Common issues involve that ChatControl modifies the chat before the other plugin, or after that, causing the wrong order. You can edit the priorities in ChatControl manually and find a suitable combination.

There are two priorities you can change. Both of them are found in the Listener_Priority section in settings.yml

  1. Listener_Priority.Formatter (Used for chat formatter and channels.)
  2. Listener_Priority.Checker (Used for antispam, anticaps, rules etc.)
  3. Listener_Priority.Signs (Used for rules on signs.)

#f03c15 NB: You must restart the server after changing the priority to take changes! #f03c15

Towny / Factions / Plots Squared

For the most servers, you will need to experiment with the values to find a suitable combination that works for you. One user has reported following configuration working well with FactionsChat:

Listener_Priority:
  Formatter: LOWEST

Punishment plugins, for example: LiteBans

If players can speak even when muted, it means that ChatControl listens to the chat event before the plugin that mutes your players, and thus allow them to speak anyway.

Users have reported that changing the Formatter priority to HIGH have fixed the issue.

You may experiment with different values (LOWEST, LOW, NORMAL, HIGH, HIGHEST and also MONITOR) to find a combination that works with your other plugins.

Denizen

Use the following settings to allow the Citizens2-Addon Denizen to catch chat-triggers for its scripts.

Listener_Priority:
  Formatter: HIGH