If any plugin registers for a GameEvent, and is disabled and reenabled, it should only fire once if that event occurs.
Actual Behavior
If you reenable a plugin several times, you're related plugin's event-method is triggered several times.
Steps to reproduce behavior
Enable plugin which register's for any game event (e.g. OpponentPlays card)
Disable plugin
Reenable plugin
Attach your debugger to the HDT process
Set breakpoint on the method for processing chosen gameevent
Let the game activate that event (e.g. let the opponent play a card)
Watch your breakpoint be hit several times instead of only once
Log/Screenshots
not needed
Possible solutions
a) In the Hearthstone_Deck_Tracker.API.ActionList.Add() method, check for duplicates before adding new tuples.
b) Implement ActionList.Remove() to allow a plugin to unregister events in OnUnload().
c) Make the content of _actions public or accessible by a plugin (via method or property), so it can check and prevent multiple registrations of events by itself
Bug report
Expected Behavior
If any plugin registers for a GameEvent, and is disabled and reenabled, it should only fire once if that event occurs.
Actual Behavior
If you reenable a plugin several times, you're related plugin's event-method is triggered several times.
Steps to reproduce behavior
Log/Screenshots
not needed
Possible solutions
a) In the Hearthstone_Deck_Tracker.API.ActionList.Add() method, check for duplicates before adding new tuples. b) Implement ActionList.Remove() to allow a plugin to unregister events in OnUnload(). c) Make the content of _actions public or accessible by a plugin (via method or property), so it can check and prevent multiple registrations of events by itself
Additional info
Two month ago, a cleanup of actions was implemented for disabled addons. But this is only done if an action is triggered, not if the plugin gets disabled! See: https://github.com/HearthSim/Hearthstone-Deck-Tracker/commit/38be9ede1bdb847f8efb09184f1938172c72b329