EventListener's Question

Discussion in 'Plugin Development' started by inventorman101, Jul 10, 2013.

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

    inventorman101

    I was just a wonderin', Should I create a second event listener for a different event, like a furnace cook event and another for a player eat event?
     
  2. Offline

    skore87

    That is entirely up to your discretion. Typically if you only have a few events it is common practice to have them in one class instead of multiple. Although it is an insignificant performance hit you will experience it when you use multiple classes.
     
  3. Offline

    Wingzzz

    You can make one listener class and have multiple events that are listened for in it. I would recommend that if you have a large plugin with many events, and some events require other methods and work inside the class that you should then make multiple listeners. Albeit, if events have small amount of code, not many other methods in the class, go for the 1 listener in the plugin. It's really up to you on readability and organization :)
     
  4. Offline

    inventorman101

    Thanks guys I will put my two events in one class :)
     
  5. Offline

    Wingzzz

    inventorman101
    Glad to hear!

    p.s: make sure to tag the thread as solved!
     
Thread Status:
Not open for further replies.

Share This Page