Allow disabling of queue command cooldown system

This commit is contained in:
ajgeiss0702
2023-04-30 10:12:41 -07:00
parent f1c9749c59
commit a91d271932
2 changed files with 12 additions and 6 deletions
@@ -62,13 +62,17 @@ public class QueueCommand extends BaseCommand {
}
AdaptedPlayer player = main.getPlatformMethods().senderToPlayer(sender);
long lastUse = cooldowns.getOrDefault(player, 0L);
if(System.currentTimeMillis() - lastUse < main.getConfig().getDouble("queue-command-cooldown") * 1000L) {
sender.sendMessage(main.getMessages().getComponent("errors.too-fast-queue"));
return;
}
double cooldownTime = main.getConfig().getDouble("queue-command-cooldown");
cooldowns.put(player, System.currentTimeMillis());
if(cooldownTime > 0) {
long lastUse = cooldowns.getOrDefault(player, 0L);
if(System.currentTimeMillis() - lastUse < cooldownTime * 1000L) {
sender.sendMessage(main.getMessages().getComponent("errors.too-fast-queue"));
return;
}
cooldowns.put(player, System.currentTimeMillis());
}
if(args.length > 0) {
if(main.getConfig().getBoolean("require-permission") && !player.hasPermission("ajqueue.queue."+args[0])) {
+2
View File
@@ -314,6 +314,8 @@ give-fulljoin-players-priority: 0
force-queue-server-target: true
# How long should the cooldown for queue commands be? (in seconds)
# Set to -1 to disable
# Default: 3
queue-command-cooldown: 3
# Should any server switch (including the initial join) count against the queue command cooldown?