Require opting into receiving cancelled events instead of opting out (#2906)

Warning for plugin developers: This is a silent BC break. It won't raise any errors.

This alters the default behaviour of event handlers to **not** receive cancelled events by default.
It is now required to opt into receiving cancelled events by using the @handleCancelled directive (or the handleCancelled parameter where it's appropriate).

The ambiguous @ignoreCancelled directive is now ignored.

Ramifications:
- The majority of handlers with `if($event->isCancelled()) return;` no longer need such checks.
- Handlers with `@ignoreCancelled true` or `@ignoreCancelled` annotations can have them removed.
- Handlers which want to receive cancelled events need to use `@handleCancelled`.
This commit is contained in:
SOFe
2019-05-27 22:47:58 +08:00
committed by Dylan T
parent 2eb498b84c
commit 3902a3c28c
3 changed files with 17 additions and 18 deletions

View File

@ -46,7 +46,7 @@ use pocketmine\plugin\PluginManager;
* - `@softDepend [PluginName]`: Handler WILL NOT be registered if its event doesn't exist. Useful for soft-depending
* on plugin events. Plugin name is optional.
* Example: `@softDepend SimpleAuth`
* - `@ignoreCancelled`: Cancelled events WILL NOT be passed to this handler.
* - `@handleCancelled`: Cancelled events will STILL invoke this handler.
* - `@priority <PRIORITY>`: Sets the priority at which this event handler will receive events.
* Example: `@priority HIGHEST`
* @see EventPriority for a list of possible options.