Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 public void handleUI() {
   DarkMod darkMod = DarkMod.getInstance();
   DarkModUI ui = darkMod.getUI();
   JButton screenshotButton = ui.getScreenshotButton();
   screenshotButton.setEnabled(true);
   if (!darkMod.isPlayingOffline()) {
     JMenuItem newSessionIDItem = ui.getNewSessionIDItem();
     newSessionIDItem.setEnabled(true);
   }
 }
Exemplo n.º 3
0
 private void startProcess(List<String> command) {
   ProcessBuilder processBuilder = new ProcessBuilder(command);
   DarkMod darkMod = DarkMod.getInstance();
   DarkModUI ui = darkMod.getUI();
   try {
     if (ui != null) {
       ui.setVisible(false);
       ui.dispose();
     }
     Process process = processBuilder.start();
     StreamRedirectFactory.createInputToOutputRedirect(process.getInputStream(), System.out);
     StreamRedirectFactory.createInputToOutputRedirect(process.getErrorStream(), System.err);
     StreamRedirectFactory.createInputToOutputRedirect(System.in, process.getOutputStream());
     System.exit(process.waitFor());
   } catch (Exception exception) {
     exception.printStackTrace();
     System.exit(-1);
   }
 }
Exemplo n.º 4
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;
 }