tedo0627 / RedstoneCircuit

This is the PocketMine plugin that implements the Redstone circuit.
GNU General Public License v3.0
84 stars 51 forks source link

Added `Cancellable` interface to event classes using `CancellableTrait` #99

Closed ColinHDev closed 2 years ago

ColinHDev commented 2 years ago

Currently, this plugin only uses PocketMine-MP's CancellableTrait to add methods like cancel() to its event classes to make them cancellable. But unlike the event classes of PocketMine-MP, it does not implement the Cancellable interface.

This is problematic because without this interface implemented, PMMP's internal event handlers won't know that those events are cancellable, which can be seen here.

Because of that, it is for example not possible to use PMMP's handleCancelled tag on handler methods to disable the calling of your listener if the event was already cancelled. This tag can only be used, if the event class you want to listen for, implements the Cancellable interface, which can be seen here.

tedo0627 commented 2 years ago

I did not realize that I had to implement Cancellable interface. Thanks.