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 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); } }
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); } }
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; }