SpockBotMC / RikerBot

C++20/Python based Minecraft bot
zlib License
46 stars 7 forks source link

Request: multiple callbacks per event, event subscription decorator #21

Closed Powana closed 3 years ago

Powana commented 3 years ago

I've implemented these for PluginBase locally, thought it might be nice to contribute to the repo too.

I find it practical to be able to have multiple methods called when a single event fires within the same plugin, e.g. adding a debug callback to an event that already has a callback method. Not currently possible within a single PluginBase instance as the events dict maps string -> string.

I also find it simpler to be able to use a decorator to subscribe methods to events, rather than having to edit the events attribute each time I want to make a change. More useful if the Plugin file is very long. Also makes it a bit easier to understand what a method does at a glance.

nickelpro commented 3 years ago

Merged