option, JOptionPane.QUESTION_MESSAGE, null, null, pretext);
if (!(key == null || key.trim().isEmpty())) {
ScriptDownloader.save(key);
}
} else if (option.equals(Messages.RUNSCRIPT)) {
final Bot current = getCurrentBot();
if (current != null) {
showScriptSelector(current);
}
} else if (option.equals(Messages.STOPSCRIPT)) {
final Bot current = getCurrentBot();
if (current != null) {
showStopScript(current);
}
} else if (option.equals(Messages.PAUSESCRIPT)) {
final Bot current = getCurrentBot();
if (current != null) {
pauseScript(current);
}
} else if (option.equals(Messages.SAVESCREENSHOT)) {
final Bot current = getCurrentBot();
if (current != null && current.getMethodContext() != null) {
ScreenshotUtil.saveScreenshot(current, current.getMethodContext().game.isLoggedIn());
}
} else if (option.equals(Messages.HIDE)) {
setTray();
} else if (option.equals(Messages.EXIT)) {
cleanExit();
}
} else if (menu.equals(Messages.EDIT)) {
if (option.equals(Messages.ACCOUNTS)) {
AccountManager.getInstance().showGUI();
} else {
final Bot current = getCurrentBot();
if (current != null) {
if (option.equals(Messages.FORCEINPUT)) {
current.overrideInput = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
updateScriptControls();
} else if (option.equals(Messages.LESSCPU)) {
current.disableRendering = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
} else if (option.equals(Messages.DISABLECANVAS)) {
current.disableGraphics = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
} else if (option.equals(Messages.EXTDVIEWS)) {
menuBar.setExtendedView(((JCheckBoxMenuItem) evt.getSource()).isSelected());
} else if (option.equals(Messages.DISABLEANTIRANDOMS)) {
current.disableRandoms = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
} else if (option.equals(Messages.DISABLEAUTOLOGIN)) {
current.disableAutoLogin = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
} else if (option.equals(Messages.DISABLETHEME)) {
Preferences.getInstance().theme = !((JCheckBoxMenuItem) evt.getSource()).isSelected();
log.info("Themes will be " + (Preferences.getInstance().theme ? "enabled" : "disabled") + " next time you run the application");
} else if (option.equals(Messages.DISABLEADS)) {
Preferences.getInstance().hideAds = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
}
}
}
} else if (menu.equals(Messages.VIEW)) {
final Bot current = getCurrentBot();
final boolean selected = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
if (option.equals(Messages.HIDETOOLBAR)) {
toggleViewState(toolBar, selected);
} else if (option.equals(Messages.HIDELOGPANE)) {
toggleViewState(textScroll, selected);
} else if (current != null) {
if (option.equals(Messages.ALLDEBUGGING)) {
for (final String key : BotMenuBar.DEBUG_MAP.keySet()) {
final Class<?> el = BotMenuBar.DEBUG_MAP.get(key);
if (menuBar.getCheckBox(key).isVisible()) {
final boolean wasSelected = menuBar.getCheckBox(key).isSelected();
menuBar.getCheckBox(key).setSelected(selected);
if (selected) {
if (!wasSelected) {
current.addListener(el);
}
} else {
if (wasSelected) {
current.removeListener(el);
}
}
}
}
} else {
final Class<?> el = BotMenuBar.DEBUG_MAP.get(option);
menuBar.getCheckBox(option).setSelected(selected);
if (selected) {
current.addListener(el);
} else {
menuBar.getCheckBox(Messages.ALLDEBUGGING).setSelected(false);
current.removeListener(el);
}
}
}
} else if (menu.equals(Messages.TOOLS)) {
if (option.equals(Messages.LICENSES)) {
log.warning("License manager coming soon");
}
} else if (menu.equals(Messages.HELP)) {
if (option.equals(Messages.SITE)) {
openURL(Configuration.Paths.URLs.SITE);
} else if (option.equals(Messages.PROJECT)) {
openURL(Configuration.Paths.URLs.PROJECT);
} else if (option.equals(Messages.LICENSE)) {
openURL(Configuration.Paths.URLs.LICENSE);
} else if (option.equals(Messages.ABOUT)) {
JOptionPane.showMessageDialog(this, new String[]{
"An open source bot developed by the community.",
"",
"RuneScape® is a trademark of Jagex © 1999 - 2011 Jagex, Ltd.",
"RuneScape content and materials are trademarks and copyrights of Jagex or its licensees.",
"This program is issued with no warranty and is not affiliated with Jagex Ltd., nor do they endorse usage of our software.",
"",
"Visit " + Configuration.Paths.URLs.SITE + "/ for more information."},
option,
JOptionPane.INFORMATION_MESSAGE);
}
} else if (menu.equals("Tab")) {
final Bot curr = getCurrentBot();
menuBar.setBot(curr);
panel.setBot(curr);
panel.repaint();
toolBar.setHome(curr == null);
setTitle(curr == null ? null : curr.getAccountName());
updateScriptControls();
}
}