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).
Currently,
command-costsandcommand-cooldownsare separate and behave slightly differently -command-costsonly supports EssentialsX's own commands and doesn't support regexes, whilecommand-cooldownssupports 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 unlesspatternis provided): the name of an EssentialsX command; these filters will ensure that the command succeeds before charging the player or starting the cooldownpattern(required unlesscommandis provided): a regex to match any plugin's command against; these filters will not check whether the command succeedscooldown(optional): the length of time that the player will have to wait until they can use a command matching this filter again, in secondscost(optional): the amount that will be deducted from the player's economy balance when they use the commandAn example looks something like this:
The use of a
commandorpatternparameter instead of a map key also avoids a bug with the currentcommand-cooldownswhere 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).