Skip to content

Commit

Permalink
Add per-command command cooldown bypass permissions (#4759)
Browse files Browse the repository at this point in the history
Adds the permission `essentials.commandcooldowns.bypass.<command name>` to bypass the cooldown for a specific command.

Closes #4747.

Co-authored-by: pop4959 <[email protected]>
Co-authored-by: MD <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2023
1 parent 17051ea commit 25ad8ac
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,8 @@ public void handlePlayerCommandPreprocess(final PlayerCommandPreprocessEvent eve
}

if (ess.getSettings().isCommandCooldownsEnabled()
&& !user.isAuthorized("essentials.commandcooldowns.bypass")) {
&& !user.isAuthorized("essentials.commandcooldowns.bypass")
&& (pluginCommand == null || !user.isAuthorized("essentials.commandcooldowns.bypass." + pluginCommand.getName()))) {
final int argStartIndex = effectiveCommand.indexOf(" ");
final String args = argStartIndex == -1 ? "" // No arguments present
: " " + effectiveCommand.substring(argStartIndex); // arguments start at argStartIndex; substring from there.
Expand Down

0 comments on commit 25ad8ac

Please sign in to comment.