Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
eingruenesbeb opened this issue Oct 28, 2023 · 1 comment
Open
1 task done
Labels
feature New feature or request

Comments

@eingruenesbeb
Copy link

I have confirmed that ...

  • There is no duplicate feature request.

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:

  • When you need to remove/add certain permissions from a muted player.
  • If you want to make items of banned players available to others by summoning a chest with their loot.
  • Sending a custom message to a player, that has had their punishment removed.
  • Adding effects like lightning

A few extra wishes for the finer details:

  • You should be able to specify, if the commands should execute before or after the action.
  • You should be able to configure, whether the action should continue, if the commands fail.
  • There be a way to specify different commands, based on context?
@eingruenesbeb eingruenesbeb added the feature New feature or request label Oct 28, 2023
@eingruenesbeb eingruenesbeb changed the title A way to execute custom commands on issuing/removing a punishment [Feature Request] A way to execute custom commands on issuing/removing a punishment Oct 28, 2023
@A248
Copy link
Owner

A248 commented Oct 28, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants