Solved Stop another plugin from handling event if mine cancels it?

Discussion in 'Spigot Plugin Development' started by joeleoli, May 31, 2016.

  1. I'm using two different plugins, both mine, both made by me.

    I have two plugins made by me, Permissions and Punishments.
    My permissions plugin handles the chat colors and prefixes of groups.
    My punishments plugin lets me mute, ban, kick, etc.

    Whenever a player chats, the Permissions plugin's AsyncPlayerChatEvent handler formats the message correctly.
    Whenever I mute a player and the player tries to chat, the Punishments plugin's AsyncPlayerChatEvent handler sets the event to canceled and sends them a message that they can't chat.

    It is calling both events, so it is still sending the message, and telling the muted player that they can't chat...
    Anyway to make it so that the event with the highest priority will only be called?
  2. Just set the one that you want to go last as higher event priority, and check if that event is cancelled and if so, return.
  3. don't forget to make this thread as solved ;)
    • Agree Agree x 1