Solved Custom Events

Discussion in 'Plugin Development' started by Codisimus, Oct 1, 2013.

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

    Codisimus

    Why can't I create a a generic event class for my plugin (Class Source) and then extend that class for each of my other events. (Example).

    I actually already understand why. This line of code calls
    Code:java
    1. .getDeclaredMethod("getHandlerList")

    Which means that my Custom Event class must declare that method itself rather than inheriting it.

    So I guess my actual question is what is the reasoning behind this? All of my events use that base code in the first link so it makes more sense to extend one class than to have the same code in 10 different spots in my code.

    If anyone can tell me why getDeclaredMethods is called rather than getMethods then I'd like to know. Otherwise I guess I can submit a PR and see what happens.

    Thanks.
     
  2. Offline

    Codisimus

    Bump...
     
  3. Offline

    Cybermaxke

  4. Offline

    Codisimus

    Cybermaxke
    I know how I can "fix" it on my end, but it seems to me that the CraftBukkit code is what needs to be "fixed".
     
  5. Offline

    Cybermaxke

    You need to add the handler methods in every event class you make. ;)
     
  6. Offline

    Codisimus

    Yes, but why?

    Nvm, I just realized that the handler list is suppose to be static. That explains it. Marking this as solved. Thanks for the help Cybermaxke

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

Share This Page