Un-cancel Events that other plugins cancelled

Discussion in 'Plugin Development' started by Badeye, Apr 20, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Badeye

    Is it possible? let's say plugin "a" cancels (for whatever reason) the CreatureSpawnEvent. Plugin "b" doesn't like that, so is it possible for plugin b to get the CreatureSpawnEvent and say:
    if(event.isCancelled()) event.setCancelled(false);
    Or would that just effect the creaturespawn in my own plugin? I mean, 2 plugins are modifying the same method, and in the end bukkkit has to make a choice, right?

    What would the outcome be, and does it make a differnece if i change the event priority of the event in plugin "b"? I am just curious.

    Well, i have tried it out. I have set the Event priority of the event in plugin "b" to a higher value than plugin "a" has. Now my question is, if the method in plugin "a" is now just completly being ignored or if just the cancelation parts are dominated by the event with the higher priority?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  2. Offline

    mmiillkkaa

    Your listeners are still called if the event is cancelled. If you are a higher priority than the plugin which cancelled the event, you can simply use event.setCancelled(false)
     
  3. Offline

    Badeye

    @mmiillkka Thanks! By the way, i like your profile pic :)
     
  4. The @EventHandler(ignoreCancelled=false priority=...) allows to specify explicitly if you receive cancelled events.

    Of course you can un-cancel other plugins events. There can be side effects, because not all plugins are double checking things and probably would assume cancelled events not getting un-cancelled. CreatureSpawn might not be problematic.

    The priorities just set up an order in which event handlers are called (1.lowest to monitor 2. order of plugin loading).

    Check here: http://wiki.bukkit.org/Introduction_to_the_New_Event_System
     
Thread Status:
Not open for further replies.

Share This Page