Ajneb97 / ConditionalEvents

MIT License
23 stars 13 forks source link

custom events should not fire when a parent event fires #2

Closed steve4744 closed 2 years ago

steve4744 commented 2 years ago

This PR is in response to an issue raised on the Parkour plugin's discord and is a fix for an issue where custom events can sometimes be detected incorrectly.

Most events will have a handler list contained within the event class, however some events (and some plugins) have event classes that inherit the handler list from a parent class.

Parkour is one such plugin where the handler list is in a parent class. So when attempting to listen for one particular Parkour event, for example PlayerFinishCourseEvent, ConditionalEvents is firing on every Parkour event that occurs.

There is a better explanation of it here: image

This fix will cause ConditionalEvents to only action the event if it exactly matches the custom event.