Quick question about multiple plugins with same event handler.

Discussion in 'Plugin Development' started by tangster132, Nov 12, 2014.

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

    tangster132

    If two different plugins use the same event handler, (for example: if they both handle BlockBreakEvent) will both event handlers run, or will one trump over the other?
     
  2. Offline

    Skionz

    They will both run.
     
  3. Offline

    tangster132

    Ah ok thanks :)

    Also, is there a way to determine/manipulate which plugin executes their handler first?
     
  4. Offline

    Skionz

    VG.Developments likes this.
  5. Offline

    FerusGrim

    Note, that in situations where there are two Handlers for the same Event, and the EventPriority is equal for them both, whichever runs first has been described as "completely random".
     
  6. FerusGrim this depends on the order the plugins are loaded and their listener are added. it is not completly random, but bukkit can't know in which order the plugins in your folder are listed and how the sort method will mix the methods up depending on your prioritys and your plugin order.
     
  7. Offline

    FerusGrim

    *which is random
     
  8. FerusGrim for loading the plugins java.io.file is used. see it's method "listFiles()" which list all files from top to bottom in an array if the file is an folder and contains something. So it is not totally random, you can controll it by sorting the plugins in the order you want to. But this is something you shouldn't do, because it is very dirty and buggy. BUT NOT RANDOM :******* :D :p
     
  9. Offline

    zackpollard

    So we're ignoring the fact that some plugins are loaded before others due to dependencies. The order isn't completely random, but then nothing is ever completely random. It's random in the sense that it is hard to calculate what will be loaded and when, and would be a huge pain to actually work it out programmatically.

    - Zack
     
    FerusGrim likes this.
  10. zackpollard that's true, but it is not random, that's all i wanted to say. But as you know, the plugins are disabled and removed at every reload and the new ones are all loaded from the folder again. so there are no loaded plugins, because if you do reload, it unloads all plugins, removes them from its list and go through the whole folder again. a reload must update a changed plugin or remove removed or add new plugins. so you're thinking the wrong way :)
     
  11. Offline

    zackpollard

    Firstly, I also said it isn't "random", but then nothing is, as I said. Now, I have no idea why you went into some random lecture about how reloading works, I see nobody who actually mentioned that. The order isn't random, but it isn't predictable either. Also, that was terribly worded, I couldn't make sense of a lot of the last half of your reply.

    - Zack
     
    FerusGrim likes this.
  12. Offline

    BrentHogeling

    zackpollard likes this.
  13. Offline

    FerusGrim

    zackpollard likes this.
  14. zackpollard i mentioned 2 points in my post.
    1. i just wanted to say, it is not random. no matter what else it is but it is not random. that's all i wanted to say and not more :)
    2. i was talking about how the files are loaded, not the plugins, so i haven't been ignorring the fact that some plugins are loaded before other due to dependencies.
     
Thread Status:
Not open for further replies.

Share This Page