Allow disabling of queue command cooldown system

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