From cde528cd548d76a17f1b56c31f7443cf3f1f8869 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Mon, 23 Oct 2023 10:56:54 +0700 Subject: [PATCH] make ipfilter faster because the new tracked core --- .../chayapak/chomens_bot/plugins/IPFilterPlugin.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/IPFilterPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/IPFilterPlugin.java index 54c81e0..df0136e 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/IPFilterPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/IPFilterPlugin.java @@ -29,7 +29,7 @@ public class IPFilterPlugin extends PlayersPlugin.Listener { bot.players.addListener(this); - bot.executor.scheduleAtFixedRate(this::checkAllPlayers, 0, 5, TimeUnit.SECONDS); + bot.executor.scheduleAtFixedRate(this::checkAllPlayers, 0, 2, TimeUnit.SECONDS); } @Override @@ -51,7 +51,7 @@ public class IPFilterPlugin extends PlayersPlugin.Listener { if (!stringified.startsWith(" - IP Address: ")) return output; - stringified = stringified.substring(" - IP Address: ".length()); + stringified = stringified.trim().substring(" - IP Address: ".length()); if (stringified.startsWith("/")) stringified = stringified.substring(1); handleIP(stringified, target); @@ -71,12 +71,7 @@ public class IPFilterPlugin extends PlayersPlugin.Listener { private void checkAllPlayers () { if (filteredIPs.isEmpty()) return; - int ms = 0; - for (PlayerEntry entry : bot.players.list) { - bot.executor.schedule(() -> check(entry), ms, TimeUnit.MILLISECONDS); - - ms += 350; - } + for (PlayerEntry entry : bot.players.list) check(entry); } public String remove (int index) {