BigBrotherBot/big-brother-bot — pull request #130 by FenixXx (2013-12-08 17:20:55+00:00)
Title: [plugin] optional event mapping over predefined methods

In the current **plugin** class, all the events are processed through the onEvent method. If a plugin register multiple events, the onEvent method would need to handle different situations; this will end up with 2 different situations:

- 1st (worst one): all the code is written inside the onEvent method.
- 2nd (slighlty better one): the onEvent method invoke other functions specifically written for the event being processed (with subsequential **if else** statements matching event.type). This is the same behavior of point 1 but with written with different syntax.

I changed this behavior adding the possibility to map a specific event over a predefined plugin method during the event registration. I made this optional in order to keep backwards compatibility.