The whole problem is because of the media control "feature" that if you press a keyboard media key, the media control also simulates a click on its buttons. And the plugin defines the appropriate action for the buttons. So everything is executed two times - one from media control buttons callback and one from music bee global hotkey.
So here is a fixed plugin for everyone who wants to have working media control buttons and working global hotkeys:
The fix uses a keyboard key press hook that watches for keyboard media key presses and saves the time of the last press. And if last press is less than 1500 milliseconds ago the media control button press is ignored.
For everyone who doesn't trust me, here is the source to see what is done and compile it yourself:
Thank you so much!