fix: make checkAllPlayers run in the ExecutorService to reduce the login lag by at least a bit
This commit is contained in:
parent
65bae4ce7d
commit
ed4c171f11
2 changed files with 5 additions and 3 deletions
|
@ -1 +1 @@
|
||||||
1120
|
1131
|
|
@ -25,7 +25,7 @@ public class IPFilterPlugin extends PlayersPlugin.Listener {
|
||||||
|
|
||||||
bot.players.addListener(this);
|
bot.players.addListener(this);
|
||||||
|
|
||||||
bot.executor.scheduleAtFixedRate(this::checkAllPlayers, 0, 2, TimeUnit.SECONDS);
|
bot.executor.scheduleAtFixedRate(this::checkAllPlayers, 0, 10, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,7 +60,9 @@ public class IPFilterPlugin extends PlayersPlugin.Listener {
|
||||||
private void checkAllPlayers () {
|
private void checkAllPlayers () {
|
||||||
if (filteredIPs.isEmpty()) return;
|
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) {
|
public String remove (int index) {
|
||||||
|
|
Loading…
Reference in a new issue