Fix shutdown method no longer shutting down when invocated directly
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
383b09a53e
commit
7f73d4fb23
@ -224,7 +224,7 @@ public class HidekoBot
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register shutdown interrupt signal listener for proper shutdown.
|
// 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.
|
// set startup time.
|
||||||
Cache.setStartupTime(LocalDateTime.now());
|
Cache.setStartupTime(LocalDateTime.now());
|
||||||
@ -244,8 +244,15 @@ public class HidekoBot
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void shutdown()
|
public static void shutdown()
|
||||||
|
{
|
||||||
|
preShutdown();
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void preShutdown()
|
||||||
{
|
{
|
||||||
LOGGER.warn("WARNING! Shutting down!");
|
LOGGER.warn("WARNING! Shutting down!");
|
||||||
if(jda != null) jda.shutdown();
|
if(jda != null) jda.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user