fix: hopefully fix some errors spam when the bot is stopping sometimes

you don't really notice it unless you host the bot on github actions which changes instance every 6 hours
This commit is contained in:
ChomeNS
2025-05-10 15:57:38 +07:00
parent 7660ac57bc
commit c392db1903
3 changed files with 6 additions and 2 deletions

View File

@@ -192,9 +192,7 @@ public class Main {
LoggerUtilities.log(stoppingMessage);
EXECUTOR.shutdown();
EXECUTOR_SERVICE.shutdown();
if (database != null) database.stop();
final ArrayList<Bot> copiedList;

View File

@@ -186,6 +186,8 @@ public class PlayersDatabasePlugin implements Listener {
@Override
public void disconnected (final DisconnectedEvent event) {
if (Main.stopping) return;
synchronized (bot.players.list) {
final List<PlayerEntry> clonedList = new ArrayList<>(bot.players.list);

View File

@@ -74,6 +74,10 @@ public class FileLoggerUtilities {
}
}
public static void stop () {
executor.shutdown();
}
private static void tick () {
if (freezeTime <= System.currentTimeMillis() && spamLevel > 0) {
spamLevel--;