Solved Do eventhandlers need to be public

Discussion in 'Plugin Development' started by acecheesecr14, Apr 6, 2014.

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

    acecheesecr14

    Do @EventHandler methods have to be public or can I make them private?
     
  2. Offline

    amhokies

    AFAIK, they should be public. Why would you ever need to make it private in the first place?
     
  3. Offline

    acecheesecr14

    Because I don't want people calling them from another class? And I'm trying to keep the jar as small as possible.
     
  4. Offline

    1Rogue

    Go ahead and test it out. See if it works.


    public/private methods don't take up any different amount of space.
     
  5. Offline

    acecheesecr14

    No but creating a new class would.
    It's an addon so then the person types
    Code:
    ClassName cn = new ClassName(x,y,z);
    /* I want the event  handler in that class.
    But not accessible by doing:
    */
    cn.onPlayerLogin(new PlayerLoginEvent(...));
    (Y) It works without error. :D Thanks guys! <3

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page