PocketMine-MP
PocketMine-MP copied to clipboard
Confusion between registerEvent() and registerEvents()
Description
It has long been a problem especially to the people who are new in PocketMine field between registerEvent()
and registerEvents()
.
That one addition of s
makes it a completely different function from the other. The reason for that is the confusing/conflicting names given to both these methods.
Alternative methods:
Following changes could be made to solve this confusion.
- registerEvents() should be changed to registerListener().
- registerEvent() should be changed to registerHandler().
I know that I struggled with this when I first started updating and writing plugins. I agree that this change would read better and make each function more transparent about what it does.
Personally I was far more confused by onCommand() but that's a topic for a separate issue.
Now, this is gonna break plugins :D
It's only one change lol. Wait till 4.0 hit the bell lol
I knew it. https://twitter.com/SOFe1970/status/1001841400416108544
bUkKiT hAs aN OuTstAnDinG aPi deSiGn
better then rename it to registerEvent => registerEventHandler registerEvents => registerEventsListener
i think, it becomes more understandable than just "registerHandler" and "registerListener", idk. if we think about fact, that these functions are in «PluginManager»
if we think about fact, that these functions are in «PluginManager»
yes, indeed