[SPIGOT-950] Method in Event.jar from Bukkit is never used but the plugin devs have to create a new one that does the same thing. Created: 31/May/15  Updated: 01/Jun/15  Resolved: 01/Jun/15

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: Felix Kraas Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: bukkit


 Description   

This is more a Bukkit report but there is no tracker for it (or i haven't found it)
The methode getHandlers() in the Event.jar in Bukkit is never called. But if you want to create a custom event you have to create a new methode called getHandlerList() that is not in the Event.jar. I would recommend to make the gethandlers() methode not abstract and add a new abstract methode called getHandlerList(). I just came across this after I spend days trying to find this mistake in my code. Without looking on tutorials you would think that the abstract methode is sufficent. This was realy anoying and i think it should be changed.



 Comments   
Comment by Felix Kraas [ 01/Jun/15 ]

Yeah, the additional JavaDoc should help. Haven't thought about the static interface thing, it's realy annoying.

Comment by md_5 [ 01/Jun/15 ]

I thought the exception was clear myself, but I've added more JavaDoc and an even clearer exception.

Comment by Xor Boole [ 31/May/15 ]

Unfortunately, the event system was designed by people who made... mistakes. There isn't really a solution, like the above said, because Java doesn't support "static interfaces", which is a very bad misfeature on oracle's part, and any attempt at a fix will break most plugins. I think a good solution is a documentation change.

Though... I suppose another option is to add some sort of registerEvent(Class<E extends Event>) method that generates the handlerlist for you. shrug

Comment by Rusty Dawson [ 31/May/15 ]

The getHandlerList() method is static, and due to the lack of static interfacing , has to be implemented manually. There is no simple fix to this issue unfortunately. Also, as a side note, the getHandlers() method is actually used within the SimplePluginManager class.

Generated at Sun Mar 30 01:56:04 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.