GraylinKim / sc2reader

A python library that extracts data from various Starcraft II resources to power tools and services for the SC2 community. Who doesn't want to hack on the games they play?
http://sc2reader.readthedocs.org
MIT License
411 stars 85 forks source link

Duplicate Events Passed to Plugins #160

Closed Databean closed 10 years ago

Databean commented 10 years ago

https://github.com/GraylinKim/sc2reader/blob/master/sc2reader/engine/engine.py#L197

The series of if statements causes some handlers to be double-added, e.g. using something like handleAbilityEvent will get matched both by the specific if on line 207 and the catch-all if at line 211 at the end, and be added to the handlers list twice. Events passed through the handlers will then get passed to those handlers twice.

GraylinKim commented 10 years ago

Ah, good catch. AbilityEvent should be an abstract event type for this to work as intended; currently it is not. I'm not sure how I overlooked this issue. I'll have to patch the events and properly separate the two concepts.