Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

stop event propogation

Comments in 'Plugin Development' started by udwarf, May 1, 2016.

  1. udwarf
    Offline

    udwarf Active Member

    Joined:
    Apr 17, 2016
    Posts:
    61
    Minecraft User:
    1Zaza
    Hi, guys!
    Sorry if this question was already asked,
    but I couldn't find if there are any way to cancel event propogation to the plugins handlers

    I'll explain with an example.
    On my server I have a simple plugin that cancels all block destructions. It simple cancels events in
    onBlockBreak handler. I call it "TheUltimateProtector"

    Another plugin wants to allow blocks breaking for particular players in particular places. Even if the second plugin cathes the event before the UltimateProtector, the event will be canceled anyway by UltimateProtector

    I think, may be there is some way to somehow prevent event handling in other plugins? like
    $event->alreadyProcessedNoNeedToPropogateToOthers(true) ?
    Sure I can add this method to the server sources but I suppose, this is not the best solution

    Thank you.
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
  3. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    The other event handler needs to have @ignoreCancelled set to true.
    applqpak and Jazzwhistle like this.

Share This Page

Advertisement