13 Commits

Author SHA1 Message Date
Dylan K. Taylor
63fc04b3dd thanks for being useless PhpStorm 2018-05-13 11:56:32 +01:00
SOFe
49fbbea7bf Implemented event handler inheritance, allow registering handlers for any valid event (#1792)
* Event handlers always handle subclass events. public static $handlerList no longer required.
* Removed $handlerList declarations
* HandlerList cleanup: Removed HandlerList->handlers and related bake methods
* Removed obsolete Event->getHandlers()
* EventPriority: Added fromString()
* PluginManager: throw exceptions on registering handlers with invalid priorities

This allows specifying a handler of `EntityDamageEvent` which will handle any instanceof it (as per current behaviour), AND also now allows specifying a handler specifically for `EntityDamageByEntityEvent`, which only handles `EntityDamageEvent`.

This was not previously possible due to limitations in the way handlers were registered.

Abstract events may not be handled unless they declare the `@allowHandle` PhpDoc tag.
2018-03-20 17:05:09 +00:00
Dylan K. Taylor
ac5a91b67e Cleaned up bool comparison mess 2018-03-19 14:10:55 +00:00
Dylan K. Taylor
6cd4d2c5a2 Added typehints and PhpDoc for events API
excluded blocks and entities events API to avoid merge conflicts
2017-07-05 16:42:06 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Shoghi Cervantes
d4b2e3d1b7
Improved heightmap generation 2015-04-29 23:19:27 +02:00
Shoghi Cervantes
8c4faa8622 Added extra Exceptions 2014-10-28 21:07:12 +01:00
Shoghi Cervantes
eab86f5f90 Replaced array() with [] 2014-08-28 17:04:22 +02:00
PEMapModder
b18783a0e7 Fix HandlerList.php wrong var name 2014-07-05 11:48:13 +08:00
Shoghi Cervantes
160c633c08 Updated trigger_error to Exceptions, fixed bug in Plugin task deletion 2014-05-26 12:22:28 +02:00
Shoghi Cervantes
f9353a0ecd Fixed Events being called with reversed priority 2014-05-24 13:40:05 +02:00
Shoghi Cervantes
6cbd39de9b Added Inventory interfaces and types, updated long array() to [] 2014-05-22 18:59:16 +02:00
Shoghi Cervantes
dd17652aca Fixed wrong paths 2014-04-01 05:06:12 +02:00