14 Commits

Author SHA1 Message Date
Dylan K. Taylor
84a16ce69a
HandlerList: fixed crash on getting unused priority
these sub-arrays are no longer allocated if no handlers are registered.

fixes #5713
2023-04-21 16:19:15 +01:00
Dylan K. Taylor
76ebedff6a
HandlerList: remove unnecessary variable 2023-04-07 22:58:30 +01:00
Dylan K. Taylor
3ea8d27a3b
HandlerList: improve listener list development to make way for #5678 2023-04-07 22:55:27 +01:00
Dylan K. Taylor
4724195791
Improved performance of event calls
This change significantly reduces the amount of work done by event handlers. Instead of traversing all of the priorities and event parent chain multiple times, we reduce event handlers down to a simple list, which doesn't require any logic to iterate over.
Previously, calling an event with lots of parents costed more than an event which directly descended from Event.
In addition, we had to do a lot of usually useless work to check all priorities, when in practice, only NORMAL will be used in almost all cases.

This change makes it more cost effective to implement the feature suggested by #5678; however, it will still require additional changes.
2023-04-05 23:02:44 +01:00
Dylan K. Taylor
f32a853bd4
HandlerList: remove useless isset 2023-04-05 21:37:08 +01:00
Dylan K. Taylor
97ef209c5f
HandlerList: added missing class-string type for constructor 2022-12-19 16:26:36 +00:00
Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
Dylan K. Taylor
eb95e2a97e
Modernize private property declarations in src/event 2022-05-17 20:45:50 +01:00
Dylan K. Taylor
aa6bd4438a
Replace disallowed operators in src/event/ 2022-01-20 19:17:17 +00:00
Dylan K. Taylor
e34364412b
Replace InvalidStateException usages with InvalidArgument or LogicException 2021-11-02 16:05:54 +00:00
Dylan K. Taylor
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
Dylan K. Taylor
b7665fd906 remove unused imports 2019-10-20 21:26:22 +01:00
Dylan K. Taylor
ef8eba43d7 RegisteredListener: validate priority at a more sensible time 2019-08-23 19:54:41 +01:00
Dylan K. Taylor
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00