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

Replace command-costs and command-cooldowns with command filters system #3200

Open
mdcfe opened this issue Apr 25, 2020 · 2 comments · May be fixed by #3886
Open

Replace command-costs and command-cooldowns with command filters system #3200

mdcfe opened this issue Apr 25, 2020 · 2 comments · May be fixed by #3886
Labels
type: discussion Thread for discussion of large changes to the plugin. type: enhancement Features and feature requests.
Milestone

Comments

@mdcfe
Copy link
Member

mdcfe commented Apr 25, 2020

Currently, command-costs and command-cooldowns are separate and behave slightly differently - command-costs only supports EssentialsX's own commands and doesn't support regexes, while command-cooldowns supports external plugins commands but doesn't ensure that the command succeeds before setting the cooldown.

The new filters system could be implemented in a separate config, which is a list of filters that contain the following options:

  • name (optional): a name for the filter, allowing perms to bypass specific filters (as well as allowing us to track cooldowns in player data; if none is provided then we can auto generate a name)
  • command (required unless pattern is provided): the name of an EssentialsX command; these filters will ensure that the command succeeds before charging the player or starting the cooldown
  • pattern (required unless command is provided): a regex to match any plugin's command against; these filters will not check whether the command succeeds
  • cooldown (optional): the length of time that the player will have to wait until they can use a command matching this filter again, in seconds
  • cost (optional): the amount that will be deducted from the player's economy balance when they use the command

An example looks something like this:

filters:
- pattern: "ban([^ip])(.*)?" # regex - doesn't ensure success
  cooldown: 60
- command: "warp" # EssentialsX built-in command - ensures success before deducting cost and starting cooldown
  cost: 100
  cooldown: 10
- name: "projectiles" # option
  pattern: "(fireball|kittycannon|beezooka)"
  cost: 10000

The use of a command or pattern parameter instead of a map key also avoids a bug with the current command-cooldowns where any regex pattern that includes . fails to parse due to YAML syntax errors.

It would be ideal to also migrate over old cooldowns to the new system (similar to how kits were done).

@mdcfe mdcfe added type: enhancement Features and feature requests. type: discussion Thread for discussion of large changes to the plugin. labels Apr 25, 2020
@mdcfe mdcfe added this to the 3.0 milestone Apr 25, 2020
@MineTheCube
Copy link

Would definitely love something like that! Lack of permission support per command is what I currently miss from these command cooldowns.

@james090500
Copy link

Definitely following this issue. I would love only /tpa and /home to cooldowned but need /warp and /spawn without a cooldown so this looks perfect for this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: discussion Thread for discussion of large changes to the plugin. type: enhancement Features and feature requests.
Projects
None yet
3 participants