Command Cooldown command-cooldown
The command cooldown feature offers the ability to give certain commands cooldowns. It also offers support to block them and REGEX matching.
Note
If you're new to regex, check out this site: https://regexr.com/ You can use it to test regex patterns and learn more about it.
Many plugins support regex in various ways, so it comes in handy more often than you think!
Config
Overview
The config is split into sections that define limitations on commands.
Here's the default config section:
cooldowns:
op:
block-op:
just-block: true
repair:
cd-fix-all:
arguments:
- 'all'
cooldown-length: 600
handle-aliases: true
ignore-in-combat: true
priority: 1
cd-fix-hand:
arguments:
- 'hand.*'
- ''
cooldown-length: 30
handle-aliases: true
ignore-in-combat: true
priority: 1
op:
block-op:
just-block: true
/op
command.
Note
When possible, use the actual command name, not an alias! This allows you to use the handle-aliases option. More on that later.
The 2nd key block-op
is arbitrary and simply must be unique.
This specification just blocks the entire command from being run by players without the admin permission of this feature.
Now let's look at this section:
cd-fix-hand:
arguments:
- 'hand.*'
- ''
cooldown-length: 30
handle-aliases: true
ignore-in-combat: true
priority: 1
repair
section and thus acts on the /repair
command.
The option handle-aliases
makes the command work on /repair
's alias as well.
The arguments
section defines which arguments to match when the player uses the command.
i.e. this will match the full commands /repair
and /repair hand
.
Note
The .* used after 'hand' is REGEX. It signifies that anything after 'hand' doesn't matter and it should match it anyway. Effectively matching strings like '/repair hand junktext'.
If ignore-in-combat
is set to true, in this case it is, then no cooldown will be issued to players who are in combat. This is useful if you don't want to prevent players in combat to receive cooldowns on already blocked commands.
Lastly, priority
denotes how high of a priority THIS argument set has compared to others.
i.e. if this section's priority is higher than another and both match the command, the cooldown (or affect) of this section applies, not the other's.
persist-cooldown
If set to true, cooldowns persist through reloads and reboots.
only-count-down-if-online
Prevents cooldowns on commands from ticking down if the player is offline.
Command
There is no command for this feature. (haha)
Permissions
- Base Level - Nothing.
- Admin Level - Bypass command cooldowns and blocks.