A248 / LibertyBans

The be-all, end-all of discipline.
https://ci.hahota.net:8443/job/LibertyBans/
GNU Affero General Public License v3.0
165 stars 40 forks source link

[Feature Request] A way to execute custom commands on issuing/removing a punishment #240

Open eingruenesbeb opened 10 months ago

eingruenesbeb commented 10 months ago

I have confirmed that ...

Description

I think it would be very beneficial to have a feature, that allows you to run custom commands, when you issue a punishment to a player and when it‘s vice versa revoked/expired.

Example:

A few extra wishes for the finer details:

A248 commented 10 months ago

We have an API for this reason. Using the LibertyBans API, developers can build different external plugins that perform these actions. For example, effects like lightning or sound can be triggered after a player is punished. You can also intercept punishments and cancel them depending on circumstances. All of this is possible if you know how to write an extra plugin.


I will caution you that there is no way to know if a command fails. For example, if a plugin (any plugin) issues a console command like /ban A248, it is impossible to check if the ban actually succeeded. There might be some tricks you can accomplish such as invoking the command executor directly; however, these choices are intentionally left to third-party plugins, and I don't think it makes sense to add them to the core LibertyBans plugin.

I will also warn you that it is difficult to know when a punishment is expired. I believe @BlueTree242 made a mechanism to fire an expiration event. However, the LibertyBans API does not expose this functionality because it implies a lot of overhead involved in checking for expiration.