Пример #1
0
 public boolean handleLoginWithoutUI(String username, String password) {
   LoginUtil loginUtil = new LoginUtil();
   if (password != null) {
     loginUtil.login(username, password);
     if (!loginUtil.isLoggedIn()) return false;
     this.username = loginUtil.getUsername();
     this.password = loginUtil.getPassword();
     sessionID = loginUtil.getSessionID();
     updateIfNecessary(loginUtil, null);
   } else {
     loginUtil.playOffline(username);
     this.username = username;
   }
   return true;
 }
Пример #2
0
 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;
 }