public void clearLoginUI(LoginUI loginUI) {
   DarkMod darkMod = DarkMod.getInstance();
   DarkModUI ui = darkMod.getUI();
   ui.remove(loginUI);
   ui.add(ui.getCanvas(), "Center");
   ui.pack();
   ui.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
 }
 public LoginUI handleLoginWithUI() {
   DarkMod darkMod = DarkMod.getInstance();
   DarkModUI ui = darkMod.getUI();
   LoginUI loginUI = new LoginUI();
   ui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   ui.remove(ui.getCanvas());
   ui.add(loginUI, "Center");
   ui.pack();
   LoginUtil loginUtil = loginUI.getLoginUtil();
   while (!loginUtil.isLoggedIn() && !loginUtil.isPlayingOffline()) {
     loginUI.authenticate();
     try {
       Thread.sleep(500);
     } catch (InterruptedException exception) {
       exception.printStackTrace();
     }
   }
   username = loginUtil.getUsername();
   password = loginUtil.getPassword();
   sessionID = loginUtil.getSessionID();
   if (loginUtil.isLoggedIn() && loginUI.isCheckForUpdatesSelected())
     updateIfNecessary(loginUtil, loginUI);
   return loginUI;
 }