From ce3c016958cc74d8ff574b662864c2169b043791 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 13 Aug 2023 11:52:13 +0700 Subject: [PATCH] t --- .../chayapak/chomens_bot/commands/UrbanCommand.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UrbanCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UrbanCommand.java index 82aab53..74a6ca9 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UrbanCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UrbanCommand.java @@ -23,7 +23,7 @@ import java.nio.charset.StandardCharsets; import java.util.concurrent.TimeUnit; public class UrbanCommand extends Command { - public int requestsPer500MS = 0; + public int requestsPerSecond = 0; public UrbanCommand () { super( @@ -35,11 +35,11 @@ public class UrbanCommand extends Command { false ); - Main.executor.scheduleAtFixedRate(() -> requestsPer500MS = 0, 0, 500, TimeUnit.MILLISECONDS); + Main.executor.scheduleAtFixedRate(() -> requestsPerSecond = 0, 0, 1, TimeUnit.SECONDS); } public Component execute (CommandContext context, String[] args, String[] fullArgs) { - if (requestsPer500MS > 10) return Component.text("Too many requests").color(NamedTextColor.RED); + if (requestsPerSecond > 3) return Component.text("Too many requests").color(NamedTextColor.RED); final Bot bot = context.bot; @@ -139,7 +139,7 @@ public class UrbanCommand extends Command { } }); - requestsPer500MS++; + requestsPerSecond++; return null; }