bzflag icon indicating copy to clipboard operation
bzflag copied to clipboard

Add bz_eReloadEvent API event

Open allejo opened this issue 6 years ago • 2 comments

This PR will allow plug-ins to safely and easily hook into /reload and bz_reload*() events. This will also allow for custom /reload subcommands without needing to overload the /reload command.

The reason behind this change is to allow plugins to have custom reload functionality.

allejo avatar Aug 20 '19 04:08 allejo

@jwmelto since the remaining comments are related, my thinking was that bz_eReloadEvent is sent as a notification event, so it'll only be sent when something actually happens (e.g. the masterban bailing out early).

As for the event.handled, I was thinking that we shouldn't let plug-ins take over built-in bzfs functionality but, we could allow plug-ins to hook into unknown reload events at which point, bzfs silences its failure messages. I know this goes against my original thought of having this event be notification-only. And having a handled could be misleading since you can't take over built-in functionality.

Whether the event should be fired before or after the action, I'm on the fence about.

Thoughts?

allejo avatar Aug 21 '19 03:08 allejo

I don’t know enough to have an informed opinion. As long as the intent is clearly commented and consistent, I defer to those of you who write plugins.

Is the distinction between notification and overridable behavior prevalent? Should the event name reflect that, like bz_eReloadNotification?

jwmelto avatar Aug 23 '19 14:08 jwmelto