make ipfilter faster because the new tracked core

This commit is contained in:
Chayapak 2023-10-23 10:56:54 +07:00
parent 73c73a2354
commit cde528cd54

View file

@ -29,7 +29,7 @@ public class IPFilterPlugin extends PlayersPlugin.Listener {
bot.players.addListener(this); bot.players.addListener(this);
bot.executor.scheduleAtFixedRate(this::checkAllPlayers, 0, 5, TimeUnit.SECONDS); bot.executor.scheduleAtFixedRate(this::checkAllPlayers, 0, 2, TimeUnit.SECONDS);
} }
@Override @Override
@ -51,7 +51,7 @@ public class IPFilterPlugin extends PlayersPlugin.Listener {
if (!stringified.startsWith(" - IP Address: ")) return output; 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); if (stringified.startsWith("/")) stringified = stringified.substring(1);
handleIP(stringified, target); handleIP(stringified, target);
@ -71,12 +71,7 @@ public class IPFilterPlugin extends PlayersPlugin.Listener {
private void checkAllPlayers () { private void checkAllPlayers () {
if (filteredIPs.isEmpty()) return; if (filteredIPs.isEmpty()) return;
int ms = 0; for (PlayerEntry entry : bot.players.list) check(entry);
for (PlayerEntry entry : bot.players.list) {
bot.executor.schedule(() -> check(entry), ms, TimeUnit.MILLISECONDS);
ms += 350;
}
} }
public String remove (int index) { public String remove (int index) {