public static void logout() { if (LogoutManager.isRunning) { return; } LogoutManager.isRunning = true; // If there's no user to worry about, we're done now. String userName = KoLCharacter.getUserName(); if (userName == null || userName.equals("")) { return; } if (!KoLmafia.isSessionEnding()) { LogoutManager.prepare(); } KoLmafia.updateDisplay("Preparing for logout..."); // Shut down chat-related activity BuffBotHome.setBuffBotActive(false); ChatManager.dispose(); // Run on-logout scripts String scriptSetting = Preferences.getString("logoutScript"); if (!scriptSetting.equals("")) { KoLmafia.updateDisplay("Executing logout script..."); KoLmafiaCLI.DEFAULT_SHELL.executeLine(scriptSetting); } if (Preferences.getBoolean("sharePriceData")) { KoLmafia.updateDisplay("Sharing mall price data with other users..."); KoLmafiaCLI.DEFAULT_SHELL.executeLine( "spade prices http://kolmafia.us/scripts/updateprices.php"); } // Clear out user data RequestLogger.closeSessionLog(); RequestLogger.closeMirror(); GenericRequest.reset(); KoLCharacter.reset(""); // Execute the logout request RequestThread.postRequest(new LogoutRequest()); KoLmafia.updateDisplay("Logout completed."); RequestLogger.closeDebugLog(); LogoutManager.isRunning = false; }