mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 03:08:58 +00:00
This cleans up some cargo-cult code poorly copied from Bukkit, which has negative performance effects and also makes internal event handling more complex than necessary. ## API changes - Removed `EventExecutor` and `MethodEventExecutor`. - A listener is no longer required for an event handler to be registered. Closure objects can now be used directly provided that they meet the conditions for registration. - `PluginManager->registerEvent()` signature has changed: the `Listener` and `EventExecutor` parameters have been removed and a `\Closure $handler` has been added in its place. - `RegisteredListener` now requires a `Closure` parameter instead of `Listener, EventExecutor`. ## Behavioural changes These changes reduce the execution complexity involved with calling an event handler. Since event calls can happen in hot paths, this may have visible positive effects on performance. Initial testing reveals a performance improvement of ~15% per event handler call compared to the old method.