System.exit(0);
}
}
}
settings = new Settings(); // Setup the Settings and wait for it to finish
final SplashScreen ss = new SplashScreen();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
ss.setVisible(true);
}
});
loadTheme();
settings.loadConsole(); // Load console AFTER L&F
if (settings.enableTrayIcon() && !skipTrayIntegration) {
try {
trySystemTrayIntegration(); // Try to enable the tray icon
} catch (Exception e) {
settings.logStackTrace(e);
}
}
LogManager.info("ATLauncher Version: " + Constants.VERSION);
LogManager.info("Operating System: " + System.getProperty("os.name"));
LogManager.info("RAM Available: " + Utils.getMaximumRam() + "MB");
if (settings.isUsingCustomJavaPath()) {
LogManager.warn("Custom Java Path Set!");
} else if (settings.isUsingMacApp()) {
File oracleJava = new File("/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java");
if (oracleJava.exists() && oracleJava.canExecute()) {
settings.setJavaPath("/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home");
LogManager.warn("Launcher Forced Custom Java Path Set!");
}
}
LogManager.info("Java Version: " + Utils.getActualJavaVersion());
LogManager.info("Java Path: " + settings.getJavaPath());
LogManager.info("64 Bit Java: " + Utils.is64Bit());
LogManager.info("Launcher Directory: " + settings.getBaseDir());
LogManager.info("Using Theme: " + THEME);
if (Utils.isMac()) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "ATLauncher " + Constants.VERSION);
try {
Class util = Class.forName("com.apple.eawt.Application");
Method getApplication = util.getMethod("getApplication", new Class[0]);
Object application = getApplication.invoke(util);
Class params[] = new Class[1];
params[0] = Image.class;
Method setDockIconImage = util.getMethod("setDockIconImage", params);
setDockIconImage.invoke(application, Utils.getImage("/assets/image/Icon.png"));
} catch (Exception ex) {
ex.printStackTrace(System.err);
}
}
if (settings.enableConsole()) {
settings.getConsole().setVisible(true);
}
LogManager.info("Showing splash screen and loading everything");
settings.loadEverything(); // Loads everything that needs to be loaded
LogManager.info("Launcher finished loading everything");
if (settings.isFirstTimeRun()) {
LogManager.warn("Launcher not setup. Loading Setup Dialog");
new SetupDialog();
}
boolean open = true;
if (autoLaunch != null && settings.isInstanceBySafeName(autoLaunch)) {
Instance instance = settings.getInstanceBySafeName(autoLaunch);
LogManager.info("Opening Instance " + instance.getName());
if (instance.launch()) {
open = false;
} else {
LogManager.error("Error Opening Instance " + instance.getName());
}
}
TRAY_MENU.localize();
integrate();
ss.close();
new LauncherFrame(open); // Open the Launcher
}