Skip to content

Commit

Permalink
Shutdown hook to save on crashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cvs0 committed Jan 20, 2025
1 parent 865ac11 commit a6eaa54
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/net/aoba/AobaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ public void loadAssets() {

LogUtils.getLogger().info("[Aoba] Aoba-chan initialized and ready to play!");

Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
endClient();
} catch (Exception e) {
LogUtils.getLogger().error("[Aoba] Error during shutdown: ", e);
}
}));

SettingManager.loadGlobalSettings();
SettingManager.loadSettings();
globalChat = new GlobalChat();
Expand Down

0 comments on commit a6eaa54

Please sign in to comment.