Fix shutdown method no longer shutting down when invocated directly
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Bea 2023-01-16 02:11:16 +01:00
parent 383b09a53e
commit 7f73d4fb23
1 changed files with 8 additions and 1 deletions

View File

@ -224,7 +224,7 @@ public class HidekoBot
}
// register shutdown interrupt signal listener for proper shutdown.
Runtime.getRuntime().addShutdownHook(new Thread(HidekoBot::shutdown));
Runtime.getRuntime().addShutdownHook(new Thread(HidekoBot::preShutdown));
// set startup time.
Cache.setStartupTime(LocalDateTime.now());
@ -244,8 +244,15 @@ public class HidekoBot
}
public static void shutdown()
{
preShutdown();
System.exit(0);
}
private static void preShutdown()
{
LOGGER.warn("WARNING! Shutting down!");
if(jda != null) jda.shutdown();
}
}