fix: make checkAllPlayers run in the ExecutorService to reduce the login lag by at least a bit

This commit is contained in:
Chayapak 2024-11-28 18:42:42 +07:00
parent 65bae4ce7d
commit ed4c171f11
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA
2 changed files with 5 additions and 3 deletions

View file

@ -1 +1 @@
1120
1131

View file

@ -25,7 +25,7 @@ public class IPFilterPlugin extends PlayersPlugin.Listener {
bot.players.addListener(this);
bot.executor.scheduleAtFixedRate(this::checkAllPlayers, 0, 2, TimeUnit.SECONDS);
bot.executor.scheduleAtFixedRate(this::checkAllPlayers, 0, 10, TimeUnit.SECONDS);
}
@Override
@ -60,7 +60,9 @@ public class IPFilterPlugin extends PlayersPlugin.Listener {
private void checkAllPlayers () {
if (filteredIPs.isEmpty()) return;
for (PlayerEntry entry : bot.players.list) check(entry);
bot.executorService.submit(() -> {
for (PlayerEntry entry : bot.players.list) check(entry);
});
}
public String remove (int index) {