Post-events, worth it ?

Discussion in 'Plugin Development' started by Digi, Mar 17, 2013.

Thread Status:
Not open for further replies.
  1. First of all, I'm talking about a new feature for the API.

    All events are pre-events, they trigger before the final action to allow devs to edit/cancel them.
    A post-event would be triggered after the action was actually applied to know for sure if/when it was applied.

    The existing events won't be affected at all and this won't involve making new event classes at all,

    Doing this would involve having a new 'post=true' argument for @EventHandler, default being false of course.
    Then making a new callEvent() method like callEventPost() that will only trigger the events having 'post=true'.
    Then using that callEventPost() in Minecraft code to trigger the event after the action actually occured.

    This is useful when people only need the end-result of the event and this method guarantees that they listen to the actual action and not a game-canceled action (plugin-canceled actions can already be detected so that's not the problem).

    I belive this is what MONITOR priority attempted to do, but that won't work.

    For example:
    CraftItemEvent triggers when player clicks result slot of a workbench, this is fine as is until you need to know if the item was actually crafted... this can be a problem because you need to check if player's inventory is full or check if cursor is full and alot of other stuff that are currently triggering that event but don't actually craft the item.
    But having the same event listened as post it is guaranteed that it will trigger if the player actually got an item from the slot because it's easy to know that in Minecraft's code.

    So yeah, I want to know if this is a good idea or not because I don't like wasting time :p
     
    jorisk322 likes this.
  2. Offline

    jtjj222

    I like it :D
    Make a pr?
     
  3. Well I asked around in the IRC and they think it's not worth it because it's not fully read-only.

    It's a bit chaos there and I am still not convinced why isn't a good idea but anyways, I don't want to waste time coding something that won't be pulled.
     
Thread Status:
Not open for further replies.

Share This Page