Called from Minecraft internally. Disconnects from the 5zig mod server, destroys the Tray Icon, finishes the AsyncExecutor and closes the sql connection.
()
| 220 | * Tray Icon, finishes the AsyncExecutor and closes the sql connection. |
| 221 | */ |
| 222 | public static void shutdown() { |
| 223 | logger.info("Stopping The 5zig Mod!"); |
| 224 | try { |
| 225 | if (api != null) { |
| 226 | api.getPluginManager().unloadAll(); |
| 227 | } |
| 228 | if (networkManager != null) { |
| 229 | networkManager.disconnect(); |
| 230 | } |
| 231 | if (trayManager != null) { |
| 232 | trayManager.destroy(); |
| 233 | } |
| 234 | asyncExecutor.finish(); |
| 235 | if (conversationDatabase != null) { |
| 236 | conversationDatabase.closeConnection(); |
| 237 | } |
| 238 | if (datamanager != null) { |
| 239 | if (datamanager.getFileTransferManager() != null) { |
| 240 | // Cleanup .part files |
| 241 | datamanager.getFileTransferManager().cleanUp(new File(modDirectory, "media/" + datamanager.getUniqueId().toString())); |
| 242 | } |
| 243 | if (datamanager.getKeyboardManager() != null) { |
| 244 | datamanager.getKeyboardManager().unInit(); |
| 245 | } |
| 246 | if (datamanager.getITunesManager() != null && datamanager.getITunesManager().getDelegate() instanceof ITunesWindowsDelegate) { |
| 247 | ((ITunesWindowsDelegate) datamanager.getITunesManager().getDelegate()).release(); |
| 248 | } |
| 249 | TeamSpeak.getClient().disconnect(); |
| 250 | } |
| 251 | } catch (Throwable throwable) { |
| 252 | logger.warn("Could not shutdown The 5zig Mod properly!", throwable); |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * @return true, if the mod already has been initialized. |
no test coverage detected