refactor: switch to settings json file instead of a properties file
This commit is contained in:
parent
1d7c0c3c77
commit
db7cbbd5a6
69 changed files with 2457 additions and 2838 deletions
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
@ -9,7 +9,7 @@
|
|||
"projectName": "ATLauncher",
|
||||
"cwd": "${workspaceFolder}/testLauncher",
|
||||
"preLaunchTask": "makeTestLauncherDirectory",
|
||||
"args": "--debug --debug-level 3 --disable-error-reporting --no-launcher-update"
|
||||
"args": "--debug --debug-level 5 --disable-error-reporting --no-launcher-update"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.io.File;
|
|||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -194,14 +195,18 @@ public class App {
|
|||
public static String autoLaunch = null;
|
||||
|
||||
/**
|
||||
* This is the Settings instance which holds all the users settings and alot of
|
||||
* methods relating to getting things done.
|
||||
*
|
||||
* @TODO This should probably be switched to be less large and have less
|
||||
* responsibility.
|
||||
* This is the Settings instance which holds all the users settings.
|
||||
*/
|
||||
public static Settings settings;
|
||||
|
||||
/**
|
||||
* This is where a lot of logic and data is held. Used to be known as
|
||||
* `Settings`.
|
||||
*
|
||||
* TODO: This needs to be broken up badly.
|
||||
*/
|
||||
public static Launcher launcher;
|
||||
|
||||
/**
|
||||
* This is the theme used by the launcher. By default it uses the default theme
|
||||
* until the theme can be created and loaded.
|
||||
|
@ -242,11 +247,14 @@ public class App {
|
|||
LogManager.logStackTrace("Error organising filesystem", e, false);
|
||||
}
|
||||
|
||||
// Setup the Settings and wait for it to finish.
|
||||
settings = new Settings();
|
||||
// Load the settings from json, convert old properties config and validate it
|
||||
loadSettings();
|
||||
|
||||
// Setup the Launcher and wait for it to finish.
|
||||
launcher = new Launcher();
|
||||
|
||||
// Load the theme and style everything.
|
||||
loadTheme(settings.getTheme());
|
||||
loadTheme(settings.theme);
|
||||
|
||||
final SplashScreen ss = new SplashScreen();
|
||||
|
||||
|
@ -256,7 +264,7 @@ public class App {
|
|||
console = new LauncherConsole();
|
||||
LogManager.start();
|
||||
|
||||
if (!noConsole && settings.enableConsole()) {
|
||||
if (!noConsole && settings.enableConsole) {
|
||||
// Show the console if enabled.
|
||||
console.setVisible(true);
|
||||
}
|
||||
|
@ -267,17 +275,17 @@ public class App {
|
|||
LogManager.logStackTrace("Error loading language", e1);
|
||||
}
|
||||
|
||||
if (!noConsole && settings.enableConsole()) {
|
||||
if (!noConsole && settings.enableConsole) {
|
||||
// Show the console if enabled.
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
console.setVisible(true);
|
||||
});
|
||||
}
|
||||
|
||||
if (settings.enableTrayIcon() && !skipTrayIntegration) {
|
||||
if (settings.enableTrayMenu && !skipTrayIntegration) {
|
||||
try {
|
||||
// Try to enable the tray icon.
|
||||
App.trySystemTrayIntegration();
|
||||
trySystemTrayIntegration();
|
||||
} catch (Exception e) {
|
||||
LogManager.logStackTrace(e);
|
||||
}
|
||||
|
@ -287,29 +295,9 @@ public class App {
|
|||
|
||||
LogManager.info("Operating System: " + System.getProperty("os.name"));
|
||||
|
||||
settings.loadJavaPathProperties();
|
||||
|
||||
if (settings.isUsingCustomJavaPath()) {
|
||||
LogManager.warn("Custom Java Path Set!");
|
||||
|
||||
settings.checkForValidJavaPath(false);
|
||||
} else if (OS.isUsingMacApp()) {
|
||||
// If the user is using the Mac Application, then we forcibly set the java path
|
||||
// if they have none set.
|
||||
|
||||
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: " + Java.getActualJavaVersion());
|
||||
|
||||
SwingUtilities.invokeLater(() -> Java.getInstalledJavas().stream()
|
||||
.forEach(version -> LogManager.debug(Gsons.DEFAULT.toJson(version))));
|
||||
|
||||
LogManager.info("Java Path: " + settings.getJavaPath());
|
||||
LogManager.info("Java Path: " + settings.javaPath);
|
||||
|
||||
LogManager.info("64 Bit Java: " + OS.is64Bit());
|
||||
|
||||
|
@ -335,9 +323,7 @@ public class App {
|
|||
|
||||
// Now for some Mac specific stuff, mainly just setting the name of the
|
||||
// application and icon.
|
||||
if (OS.isMac())
|
||||
|
||||
{
|
||||
if (OS.isMac()) {
|
||||
System.setProperty("apple.laf.useScreenMenuBar", "true");
|
||||
System.setProperty("com.apple.mrj.application.apple.menu.about.name",
|
||||
Constants.LAUNCHER_NAME + " " + Constants.VERSION);
|
||||
|
@ -353,13 +339,13 @@ public class App {
|
|||
}
|
||||
|
||||
// Check to make sure the user can load the launcher
|
||||
settings.checkIfWeCanLoad();
|
||||
launcher.checkIfWeCanLoad();
|
||||
|
||||
LogManager.info("Showing splash screen and loading everything");
|
||||
settings.loadEverything(); // Loads everything that needs to be loaded
|
||||
launcher.loadEverything(); // Loads everything that needs to be loaded
|
||||
LogManager.info("Launcher finished loading everything");
|
||||
|
||||
if (settings.isFirstTimeRun()) {
|
||||
if (settings.firstTimeRun) {
|
||||
LogManager.warn("Launcher not setup. Loading Setup Dialog");
|
||||
new SetupDialog();
|
||||
}
|
||||
|
@ -367,17 +353,17 @@ public class App {
|
|||
boolean open = true;
|
||||
|
||||
if (autoLaunch != null) {
|
||||
if (settings.isInstanceBySafeName(autoLaunch)) {
|
||||
Instance instance = settings.getInstanceBySafeName(autoLaunch);
|
||||
if (launcher.isInstanceBySafeName(autoLaunch)) {
|
||||
Instance instance = launcher.getInstanceBySafeName(autoLaunch);
|
||||
LogManager.info("Opening Instance " + instance.getName());
|
||||
if (instance.launch()) {
|
||||
open = false;
|
||||
} else {
|
||||
LogManager.error("Error Opening Instance " + instance.getName());
|
||||
}
|
||||
} else if (settings.instancesV2.stream()
|
||||
} else if (launcher.instancesV2.stream()
|
||||
.anyMatch(instance -> instance.getSafeName().equalsIgnoreCase(autoLaunch))) {
|
||||
Optional<InstanceV2> instance = settings.instancesV2.stream()
|
||||
Optional<InstanceV2> instance = launcher.instancesV2.stream()
|
||||
.filter(instanceV2 -> instanceV2.getSafeName().equalsIgnoreCase(autoLaunch)).findFirst();
|
||||
|
||||
if (instance.isPresent()) {
|
||||
|
@ -391,7 +377,7 @@ public class App {
|
|||
}
|
||||
}
|
||||
|
||||
if (settings.enableDiscordIntegration()) {
|
||||
if (settings.enableDiscordIntegration) {
|
||||
try {
|
||||
DiscordEventHandlers handlers = new DiscordEventHandlers.Builder().build();
|
||||
DiscordRPC.discordInitialize(Constants.DISCORD_CLIENT_ID, handlers, true);
|
||||
|
@ -410,8 +396,8 @@ public class App {
|
|||
}
|
||||
|
||||
if (packCodeToAdd != null) {
|
||||
if (settings.addPack(packCodeToAdd)) {
|
||||
Pack packAdded = settings.getSemiPublicPackByCode(packCodeToAdd);
|
||||
if (launcher.addPack(packCodeToAdd)) {
|
||||
Pack packAdded = launcher.getSemiPublicPackByCode(packCodeToAdd);
|
||||
if (packAdded != null) {
|
||||
LogManager.info("The pack " + packAdded.getName() + " was automatically added to the launcher!");
|
||||
} else {
|
||||
|
@ -490,6 +476,40 @@ public class App {
|
|||
}
|
||||
}
|
||||
|
||||
private static void loadSettings() {
|
||||
// load the users settings or load defaults if settings file doesn't exist
|
||||
if (Files.exists(FileSystem.SETTINGS)) {
|
||||
try (FileReader fileReader = new FileReader(FileSystem.SETTINGS.toFile())) {
|
||||
settings = Gsons.DEFAULT.fromJson(fileReader, Settings.class);
|
||||
} catch (Throwable t) {
|
||||
LogManager.logStackTrace("Error loading settings, using defaults", t, false);
|
||||
settings = new Settings();
|
||||
}
|
||||
} else {
|
||||
settings = new Settings();
|
||||
}
|
||||
|
||||
if (Files.exists(FileSystem.LAUNCHER_CONFIG)) {
|
||||
try (FileReader fileReader = new FileReader(FileSystem.LAUNCHER_CONFIG.toFile())) {
|
||||
Properties properties = new Properties();
|
||||
properties.load(fileReader);
|
||||
settings.convert(properties);
|
||||
} catch (Throwable t) {
|
||||
LogManager.logStackTrace("Error loading settings, using defaults", t, false);
|
||||
settings = new Settings();
|
||||
}
|
||||
|
||||
try {
|
||||
Files.delete(FileSystem.LAUNCHER_CONFIG);
|
||||
} catch (IOException e) {
|
||||
LogManager.warn("Failed to delete old launcher config.");
|
||||
}
|
||||
}
|
||||
|
||||
// validate the settings
|
||||
settings.validate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the look and feel of the application.
|
||||
*
|
||||
|
@ -500,7 +520,7 @@ public class App {
|
|||
Class.forName(theme);
|
||||
} catch (NoClassDefFoundError | ClassNotFoundException e) {
|
||||
theme = Constants.DEFAULT_THEME_CLASS;
|
||||
App.settings.setTheme(theme);
|
||||
settings.theme = theme;
|
||||
}
|
||||
|
||||
// install the theme
|
||||
|
@ -529,9 +549,9 @@ public class App {
|
|||
ToolTipManager.sharedInstance().setInitialDelay(50);
|
||||
|
||||
UIManager.put("Table.focusCellHighlightBorder", BorderFactory.createEmptyBorder(2, 5, 2, 5));
|
||||
UIManager.put("defaultFont", App.THEME.getNormalFont());
|
||||
UIManager.put("Button.font", App.THEME.getNormalFont());
|
||||
UIManager.put("Toaster.font", App.THEME.getNormalFont());
|
||||
UIManager.put("defaultFont", THEME.getNormalFont());
|
||||
UIManager.put("Button.font", THEME.getNormalFont());
|
||||
UIManager.put("Toaster.font", THEME.getNormalFont());
|
||||
UIManager.put("Toaster.opacity", 0.75F);
|
||||
|
||||
UIManager.put("FileChooser.readOnly", Boolean.TRUE);
|
||||
|
|
|
@ -64,6 +64,7 @@ public final class FileSystem {
|
|||
public static final Path CHECKING_SERVERS_JSON = CONFIGS.resolve("checkingservers.json");
|
||||
public static final Path USER_DATA = CONFIGS.resolve("userdata");
|
||||
public static final Path LAUNCHER_CONFIG = CONFIGS.resolve(Constants.LAUNCHER_NAME + ".conf");
|
||||
public static final Path SETTINGS = CONFIGS.resolve(Constants.LAUNCHER_NAME + ".json");
|
||||
|
||||
/**
|
||||
* This will organise the file system. This will remove old folders, create
|
||||
|
|
1624
src/main/java/com/atlauncher/Launcher.java
Normal file
1624
src/main/java/com/atlauncher/Launcher.java
Normal file
File diff suppressed because it is too large
Load diff
|
@ -555,7 +555,7 @@ public class Account implements Serializable {
|
|||
} catch (IOException e) {
|
||||
LogManager.logStackTrace(e);
|
||||
}
|
||||
App.settings.reloadAccounts();
|
||||
App.launcher.reloadAccounts();
|
||||
}
|
||||
dialog.close();
|
||||
}));
|
||||
|
@ -703,14 +703,14 @@ public class Account implements Serializable {
|
|||
if (ret == DialogManager.OK_OPTION) {
|
||||
if (passwordField.getPassword().length == 0) {
|
||||
LogManager.error("Aborting login for " + this.getMinecraftUsername() + ", no password entered");
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
return null;
|
||||
}
|
||||
|
||||
this.setPassword(new String(passwordField.getPassword()));
|
||||
} else {
|
||||
LogManager.error("Aborting login for " + this.getMinecraftUsername());
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ public class Account implements Serializable {
|
|||
+ "<br/><br/>" + response.getErrorMessage()).build())
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -739,7 +739,7 @@ public class Account implements Serializable {
|
|||
if (!response.isOffline()) {
|
||||
this.setUUID(response.getAuth().getSelectedProfile().getId().toString());
|
||||
this.setStore(response.getAuth().saveForStorage());
|
||||
App.settings.saveAccounts();
|
||||
App.launcher.saveAccounts();
|
||||
}
|
||||
|
||||
return response;
|
||||
|
|
|
@ -366,9 +366,9 @@ public class DisableableMod implements Serializable {
|
|||
Stream<CurseFile> curseFilesStream = curseModFiles.stream()
|
||||
.sorted(Comparator.comparingInt((CurseFile file) -> file.id).reversed());
|
||||
|
||||
if (!App.settings.disabledAddModRestrictions()) {
|
||||
curseFilesStream = curseFilesStream.filter(
|
||||
file -> App.settings.disabledAddModRestrictions() || file.gameVersion.contains(instance.id));
|
||||
if (!App.settings.disableAddModRestrictions) {
|
||||
curseFilesStream = curseFilesStream
|
||||
.filter(file -> App.settings.disableAddModRestrictions || file.gameVersion.contains(instance.id));
|
||||
}
|
||||
|
||||
if (!curseFilesStream.anyMatch(mod -> mod.id > curseFileId)) {
|
||||
|
@ -389,8 +389,8 @@ public class DisableableMod implements Serializable {
|
|||
Stream<CurseFile> curseFilesStream = curseModFiles.stream()
|
||||
.sorted(Comparator.comparingInt((CurseFile file) -> file.id).reversed());
|
||||
|
||||
if (!App.settings.disabledAddModRestrictions()) {
|
||||
curseFilesStream = curseFilesStream.filter(file -> App.settings.disabledAddModRestrictions()
|
||||
if (!App.settings.disableAddModRestrictions) {
|
||||
curseFilesStream = curseFilesStream.filter(file -> App.settings.disableAddModRestrictions
|
||||
|| file.gameVersion.contains(instance.getMinecraftVersion()));
|
||||
}
|
||||
|
||||
|
|
|
@ -286,8 +286,8 @@ public class Instance implements Cloneable {
|
|||
this.minecraftArguments = minecraftArguments;
|
||||
this.isDev = isDev;
|
||||
this.isPlayable = isPlayable;
|
||||
if (enableUserLock && !App.settings.getAccount().isUUIDNull()) {
|
||||
this.userLock = App.settings.getAccount().getUUIDNoDashes();
|
||||
if (enableUserLock && !App.launcher.account.isUUIDNull()) {
|
||||
this.userLock = App.launcher.account.getUUIDNoDashes();
|
||||
} else {
|
||||
this.userLock = null;
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ public class Instance implements Cloneable {
|
|||
|
||||
if (!hasUpdateBeenIgnored(version)) {
|
||||
this.ignoredUpdates.add(version);
|
||||
App.settings.saveInstances();
|
||||
App.launcher.saveInstances();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ public class Instance implements Cloneable {
|
|||
|
||||
public MinecraftVersion getActualMinecraftVersion() {
|
||||
try {
|
||||
return App.settings.getMinecraftVersion(this.minecraftVersion);
|
||||
return App.launcher.getMinecraftVersion(this.minecraftVersion);
|
||||
} catch (InvalidMinecraftVersion e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1207,13 +1207,13 @@ public class Instance implements Cloneable {
|
|||
*/
|
||||
public boolean canPlay() {
|
||||
// Make sure an account is selected first.
|
||||
if (App.settings.getAccount() == null || !App.settings.getAccount().isReal()) {
|
||||
if (App.launcher.account == null || !App.launcher.account.isReal()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check to see if this was a private Instance belonging to a specific user
|
||||
// only.
|
||||
if (this.userLock != null && !App.settings.getAccount().getUUIDNoDashes().equalsIgnoreCase(this.userLock)) {
|
||||
if (this.userLock != null && !App.launcher.account.getUUIDNoDashes().equalsIgnoreCase(this.userLock)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1344,17 +1344,17 @@ public class Instance implements Cloneable {
|
|||
* @return true if the Minecraft process was started
|
||||
*/
|
||||
public boolean launch() {
|
||||
final Account account = App.settings.getAccount();
|
||||
final Account account = App.launcher.account;
|
||||
if (account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot play instance as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
return false;
|
||||
} else {
|
||||
Integer maximumMemory = (this.settings == null || this.settings.getMaximumMemory() == null)
|
||||
? App.settings.getMaximumMemory()
|
||||
? App.settings.maximumMemory
|
||||
: settings.getMaximumMemory();
|
||||
if ((maximumMemory < this.memory) && (this.memory <= OS.getSafeMaximumRam())) {
|
||||
int ret = DialogManager.optionDialog().setTitle(GetText.tr("Insufficient Ram"))
|
||||
|
@ -1366,11 +1366,11 @@ public class Instance implements Cloneable {
|
|||
|
||||
if (ret != 0) {
|
||||
LogManager.warn("Launching of instance cancelled due to user cancelling memory warning!");
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Integer permGen = (this.settings == null || this.settings.getPermGen() == null) ? App.settings.getPermGen()
|
||||
Integer permGen = (this.settings == null || this.settings.getPermGen() == null) ? App.settings.metaspace
|
||||
: settings.getPermGen();
|
||||
if (permGen < this.permgen) {
|
||||
int ret = DialogManager.optionDialog().setTitle(GetText.tr("Insufficent Permgen"))
|
||||
|
@ -1381,7 +1381,7 @@ public class Instance implements Cloneable {
|
|||
.setDefaultOption(DialogManager.YES_OPTION).show();
|
||||
if (ret != 0) {
|
||||
LogManager.warn("Launching of instance cancelled due to user cancelling permgen warning!");
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1406,8 +1406,8 @@ public class Instance implements Cloneable {
|
|||
Thread launcher = new Thread(() -> {
|
||||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
if (App.settings.getParent() != null) {
|
||||
App.settings.getParent().setVisible(false);
|
||||
if (App.launcher.getParent() != null) {
|
||||
App.launcher.getParent().setVisible(false);
|
||||
}
|
||||
|
||||
LogManager.info("Launching pack " + getPackName() + " " + getVersion() + " for " + "Minecraft "
|
||||
|
@ -1416,12 +1416,11 @@ public class Instance implements Cloneable {
|
|||
Process process = MCLauncher.launch(account, Instance.this, session);
|
||||
|
||||
if ((App.autoLaunch != null && App.closeLauncher)
|
||||
|| (!App.settings.keepLauncherOpen() && !App.settings.enableLogs())) {
|
||||
|| (!App.settings.keepLauncherOpen && !App.settings.enableLogs)) {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
if (App.settings.enableDiscordIntegration() && App.discordInitialized
|
||||
&& this.getRealPack() != null) {
|
||||
if (App.settings.enableDiscordIntegration && App.discordInitialized && this.getRealPack() != null) {
|
||||
String playing = this.getRealPack().getName() + " (" + this.getVersion() + ")";
|
||||
|
||||
DiscordRichPresence.Builder presence = new DiscordRichPresence.Builder("");
|
||||
|
@ -1438,7 +1437,7 @@ public class Instance implements Cloneable {
|
|||
DiscordRPC.discordUpdatePresence(presence.build());
|
||||
}
|
||||
|
||||
App.settings.showKillMinecraft(process);
|
||||
App.launcher.showKillMinecraft(process);
|
||||
InputStream is = process.getInputStream();
|
||||
InputStreamReader isr = new InputStreamReader(is);
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
|
@ -1468,12 +1467,12 @@ public class Instance implements Cloneable {
|
|||
}
|
||||
LogManager.minecraft(line);
|
||||
}
|
||||
App.settings.hideKillMinecraft();
|
||||
if (App.settings.getParent() != null && App.settings.keepLauncherOpen()) {
|
||||
App.settings.getParent().setVisible(true);
|
||||
App.launcher.hideKillMinecraft();
|
||||
if (App.launcher.getParent() != null && App.settings.keepLauncherOpen) {
|
||||
App.launcher.getParent().setVisible(true);
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
if (App.settings.enableDiscordIntegration()) {
|
||||
if (App.settings.enableDiscordIntegration) {
|
||||
DiscordRPC.discordClearPresence();
|
||||
}
|
||||
int exitValue = 0; // Assume we exited fine
|
||||
|
@ -1482,14 +1481,14 @@ public class Instance implements Cloneable {
|
|||
} catch (IllegalThreadStateException e) {
|
||||
process.destroy(); // Kill the process
|
||||
}
|
||||
if (!App.settings.keepLauncherOpen()) {
|
||||
if (!App.settings.keepLauncherOpen) {
|
||||
App.console.setVisible(false); // Hide the console to pretend
|
||||
// we've closed
|
||||
}
|
||||
if (exitValue != 0) {
|
||||
// Submit any pending crash reports from Open Eye if need to since we
|
||||
// exited abnormally
|
||||
if (App.settings.enableLogs() && App.settings.enableOpenEyeReporting()) {
|
||||
if (App.settings.enableLogs && App.settings.enableOpenEyeReporting) {
|
||||
App.TASKPOOL.submit(this::sendOpenEyePendingReports);
|
||||
}
|
||||
}
|
||||
|
@ -1498,8 +1497,8 @@ public class Instance implements Cloneable {
|
|||
MinecraftError.showInformationPopup(detectedError);
|
||||
}
|
||||
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
if (isLoggingEnabled() && !isDev() && App.settings.enableLogs()) {
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
if (isLoggingEnabled() && !isDev() && App.settings.enableLogs) {
|
||||
final int timePlayed = (int) (end - start) / 1000;
|
||||
if (timePlayed > 0) {
|
||||
App.TASKPOOL.submit(() -> {
|
||||
|
@ -1507,10 +1506,10 @@ public class Instance implements Cloneable {
|
|||
});
|
||||
}
|
||||
}
|
||||
if (App.settings.keepLauncherOpen() && App.settings.checkForUpdatedFiles()) {
|
||||
App.settings.reloadLauncherData();
|
||||
if (App.settings.keepLauncherOpen && App.launcher.checkForUpdatedFiles()) {
|
||||
App.launcher.reloadLauncherData();
|
||||
}
|
||||
if (!App.settings.keepLauncherOpen()) {
|
||||
if (!App.settings.keepLauncherOpen) {
|
||||
System.exit(0);
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
|
|
|
@ -117,7 +117,7 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
return null;
|
||||
}
|
||||
|
||||
return App.settings.packs.stream().filter(p -> p.id == this.launcher.packId).findFirst().orElse(null);
|
||||
return App.launcher.packs.stream().filter(p -> p.id == this.launcher.packId).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public boolean hasUpdate() {
|
||||
|
@ -375,7 +375,7 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
}
|
||||
|
||||
public boolean launch() {
|
||||
final Account account = App.settings.getAccount();
|
||||
final Account account = App.launcher.account;
|
||||
|
||||
if (account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
|
@ -383,10 +383,10 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
.text(GetText.tr("Cannot play instance as you have no account selected.")).build())
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
return false;
|
||||
} else {
|
||||
Integer maximumMemory = (this.launcher.maximumMemory == null) ? App.settings.getMaximumMemory()
|
||||
Integer maximumMemory = (this.launcher.maximumMemory == null) ? App.settings.maximumMemory
|
||||
: this.launcher.maximumMemory;
|
||||
if ((maximumMemory < this.launcher.requiredMemory)
|
||||
&& (this.launcher.requiredMemory <= OS.getSafeMaximumRam())) {
|
||||
|
@ -399,11 +399,11 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
|
||||
if (ret != 0) {
|
||||
LogManager.warn("Launching of instance cancelled due to user cancelling memory warning!");
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Integer permGen = (this.launcher.permGen == null) ? App.settings.getPermGen() : this.launcher.permGen;
|
||||
Integer permGen = (this.launcher.permGen == null) ? App.settings.metaspace : this.launcher.permGen;
|
||||
if (permGen < this.launcher.requiredPermGen) {
|
||||
int ret = DialogManager.optionDialog().setTitle(GetText.tr("Insufficent Permgen"))
|
||||
.setContent(new HTMLBuilder().center().text(GetText.tr(
|
||||
|
@ -413,7 +413,7 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
.setDefaultOption(DialogManager.YES_OPTION).show();
|
||||
if (ret != 0) {
|
||||
LogManager.warn("Launching of instance cancelled due to user cancelling permgen warning!");
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -462,8 +462,8 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
Thread launcher = new Thread(() -> {
|
||||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
if (App.settings.getParent() != null) {
|
||||
App.settings.getParent().setVisible(false);
|
||||
if (App.launcher.getParent() != null) {
|
||||
App.launcher.getParent().setVisible(false);
|
||||
}
|
||||
|
||||
LogManager.info("Launching pack " + this.launcher.pack + " " + this.launcher.version + " for "
|
||||
|
@ -472,15 +472,15 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
Process process = MCLauncher.launch(account, this, session, nativesTempDir);
|
||||
|
||||
if ((App.autoLaunch != null && App.closeLauncher)
|
||||
|| (!App.settings.keepLauncherOpen() && !App.settings.enableLogs())) {
|
||||
if (App.settings.enableLogs()) {
|
||||
|| (!App.settings.keepLauncherOpen && !App.settings.enableLogs)) {
|
||||
if (App.settings.enableLogs) {
|
||||
addTimePlayed(1, this.launcher.version); // count the stats, just without time played
|
||||
}
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
if (App.settings.enableDiscordIntegration() && this.getPack() != null) {
|
||||
if (App.settings.enableDiscordIntegration && this.getPack() != null) {
|
||||
String playing = this.getPack().name + " (" + this.launcher.version + ")";
|
||||
|
||||
DiscordRichPresence.Builder presence = new DiscordRichPresence.Builder("");
|
||||
|
@ -497,7 +497,7 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
DiscordRPC.discordUpdatePresence(presence.build());
|
||||
}
|
||||
|
||||
App.settings.showKillMinecraft(process);
|
||||
App.launcher.showKillMinecraft(process);
|
||||
InputStream is = process.getInputStream();
|
||||
InputStreamReader isr = new InputStreamReader(is);
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
|
@ -515,7 +515,8 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
detectedError = MinecraftError.CONCURRENT_MODIFICATION_ERROR_1_6;
|
||||
}
|
||||
|
||||
if (line.contains("class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class")) {
|
||||
if (line.contains(
|
||||
"class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class")) {
|
||||
detectedError = MinecraftError.USING_NEWER_JAVA_THAN_8;
|
||||
}
|
||||
|
||||
|
@ -531,12 +532,12 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
}
|
||||
LogManager.minecraft(line);
|
||||
}
|
||||
App.settings.hideKillMinecraft();
|
||||
if (App.settings.getParent() != null && App.settings.keepLauncherOpen()) {
|
||||
App.settings.getParent().setVisible(true);
|
||||
App.launcher.hideKillMinecraft();
|
||||
if (App.launcher.getParent() != null && App.settings.keepLauncherOpen) {
|
||||
App.launcher.getParent().setVisible(true);
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
if (App.settings.enableDiscordIntegration()) {
|
||||
if (App.settings.enableDiscordIntegration) {
|
||||
DiscordRPC.discordClearPresence();
|
||||
}
|
||||
int exitValue = 0; // Assume we exited fine
|
||||
|
@ -545,13 +546,13 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
} catch (IllegalThreadStateException e) {
|
||||
process.destroy(); // Kill the process
|
||||
}
|
||||
if (!App.settings.keepLauncherOpen()) {
|
||||
if (!App.settings.keepLauncherOpen) {
|
||||
App.console.setVisible(false); // Hide the console to pretend we've closed
|
||||
}
|
||||
if (exitValue != 0) {
|
||||
// Submit any pending crash reports from Open Eye if need to since we
|
||||
// exited abnormally
|
||||
if (App.settings.enableLogs() && App.settings.enableOpenEyeReporting()) {
|
||||
if (App.settings.enableLogs && App.settings.enableOpenEyeReporting) {
|
||||
App.TASKPOOL.submit(this::sendOpenEyePendingReports);
|
||||
}
|
||||
}
|
||||
|
@ -560,9 +561,9 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
MinecraftError.showInformationPopup(detectedError);
|
||||
}
|
||||
|
||||
App.settings.setMinecraftLaunched(false);
|
||||
App.launcher.setMinecraftLaunched(false);
|
||||
if (this.getPack() != null && this.getPack().isLoggingEnabled() && !this.launcher.isDev
|
||||
&& App.settings.enableLogs()) {
|
||||
&& App.settings.enableLogs) {
|
||||
final int timePlayed = (int) (end - start) / 1000;
|
||||
if (timePlayed > 0) {
|
||||
App.TASKPOOL.submit(() -> {
|
||||
|
@ -570,13 +571,13 @@ public class InstanceV2 extends MinecraftVersion {
|
|||
});
|
||||
}
|
||||
}
|
||||
if (App.settings.keepLauncherOpen() && App.settings.checkForUpdatedFiles()) {
|
||||
App.settings.reloadLauncherData();
|
||||
if (App.settings.keepLauncherOpen && App.launcher.checkForUpdatedFiles()) {
|
||||
App.launcher.reloadLauncherData();
|
||||
}
|
||||
if (Files.isDirectory(nativesTempDir)) {
|
||||
FileUtils.deleteDirectory(nativesTempDir);
|
||||
}
|
||||
if (!App.settings.keepLauncherOpen()) {
|
||||
if (!App.settings.keepLauncherOpen) {
|
||||
System.exit(0);
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
|
|
|
@ -91,7 +91,7 @@ public class LoginResponse {
|
|||
}
|
||||
|
||||
public void save() {
|
||||
Account account = App.settings.getAccountByName(this.username);
|
||||
Account account = App.launcher.getAccountByName(this.username);
|
||||
|
||||
if (account != null) {
|
||||
account.setStore(this.auth.saveForStorage());
|
||||
|
|
|
@ -49,7 +49,7 @@ public class News {
|
|||
|
||||
private String getFormattedDate() {
|
||||
DateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSX");
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(App.settings.getDateFormat() + " HH:mm:ss a");
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(App.settings.dateFormat + " HH:mm:ss a");
|
||||
|
||||
try {
|
||||
return formatter.format(iso8601Format.parse(this.createdAt));
|
||||
|
|
|
@ -159,7 +159,7 @@ public class Pack {
|
|||
}
|
||||
|
||||
public boolean isTester() {
|
||||
Account account = App.settings.getAccount();
|
||||
Account account = App.launcher.account;
|
||||
if (account == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public class Pack {
|
|||
return true;
|
||||
}
|
||||
} else if (this.type == PackType.SEMIPUBLIC && this.code != null) {
|
||||
if (isTester() || (hasVersions() && App.settings.canViewSemiPublicPackByCode(this.code))) {
|
||||
if (isTester() || (hasVersions() && App.launcher.canViewSemiPublicPackByCode(this.code))) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
@ -200,7 +200,7 @@ public class Pack {
|
|||
if (this.type != PackType.PRIVATE) {
|
||||
return true;
|
||||
}
|
||||
Account account = App.settings.getAccount();
|
||||
Account account = App.launcher.account;
|
||||
if (account == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class PackUsers {
|
|||
public void addUsers() {
|
||||
Pack pack = null;
|
||||
try {
|
||||
pack = App.settings.getPackByID(this.pack);
|
||||
pack = App.launcher.getPackByID(this.pack);
|
||||
} catch (InvalidPack e) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class PackVersionTypeAdapter implements JsonDeserializer<PackVersion> {
|
|||
|
||||
if (rootJsonObject.has("minecraft")) {
|
||||
try {
|
||||
packVersion.minecraftVersion = App.settings
|
||||
packVersion.minecraftVersion = App.launcher
|
||||
.getMinecraftVersion(rootJsonObject.get("minecraft").getAsString());
|
||||
} catch (InvalidMinecraftVersion e) {
|
||||
LogManager.error(e.getMessage());
|
||||
|
|
|
@ -73,7 +73,7 @@ public class Server {
|
|||
}
|
||||
|
||||
public Pack getPack() {
|
||||
return App.settings.packs.stream().filter(p -> p.id == this.packId).findFirst().orElse(null);
|
||||
return App.launcher.packs.stream().filter(p -> p.id == this.packId).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public void launch(boolean close) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -72,7 +72,7 @@ public final class LauncherFrame extends JFrame implements RelocalizationListene
|
|||
LogManager.info("Made By Bob*");
|
||||
LogManager.info("*(Not Actually)");
|
||||
|
||||
App.settings.setParentFrame(this);
|
||||
App.launcher.setParentFrame(this);
|
||||
setSize(new Dimension(1200, 700));
|
||||
setTitle(Constants.LAUNCHER_NAME + " " + Constants.VERSION);
|
||||
setLocationRelativeTo(null);
|
||||
|
@ -112,13 +112,13 @@ public final class LauncherFrame extends JFrame implements RelocalizationListene
|
|||
RelocalizationManager.addListener(this);
|
||||
|
||||
if (App.packToInstall != null) {
|
||||
Pack pack = App.settings.getPackBySafeName(App.packToInstall);
|
||||
Pack pack = App.launcher.getPackBySafeName(App.packToInstall);
|
||||
|
||||
if (pack != null && pack.isSemiPublic() && !App.settings.canViewSemiPublicPackByCode(pack.getCode())) {
|
||||
if (pack != null && pack.isSemiPublic() && !App.launcher.canViewSemiPublicPackByCode(pack.getCode())) {
|
||||
LogManager.error("Error automatically installing " + pack.getName() + " as you don't have the "
|
||||
+ "pack added to the launcher!");
|
||||
} else {
|
||||
if (App.settings.getAccount() == null || pack == null) {
|
||||
if (App.launcher.account == null || pack == null) {
|
||||
LogManager
|
||||
.error("Error automatically installing " + (pack == null ? "pack" : pack.getName()) + "!");
|
||||
} else {
|
||||
|
@ -131,9 +131,9 @@ public final class LauncherFrame extends JFrame implements RelocalizationListene
|
|||
if (parts.length != 4) {
|
||||
LogManager.error("Error automatically installing pack from share code!");
|
||||
} else {
|
||||
Pack pack = App.settings.getPackBySafeName(parts[0]);
|
||||
Pack pack = App.launcher.getPackBySafeName(parts[0]);
|
||||
|
||||
if (pack != null && pack.isSemiPublic() && !App.settings.canViewSemiPublicPackByCode(pack.getCode())) {
|
||||
if (pack != null && pack.isSemiPublic() && !App.launcher.canViewSemiPublicPackByCode(pack.getCode())) {
|
||||
LogManager.error("Error automatically installing " + pack.getName() + " as you don't have the "
|
||||
+ "pack added to the launcher!");
|
||||
} else {
|
||||
|
@ -166,22 +166,22 @@ public final class LauncherFrame extends JFrame implements RelocalizationListene
|
|||
});
|
||||
|
||||
newsTab = new NewsTab();
|
||||
App.settings.setNewsPanel(newsTab);
|
||||
App.launcher.setNewsPanel(newsTab);
|
||||
|
||||
vanillaPacksTab = new PacksTab(false, true);
|
||||
App.settings.setVanillaPacksPanel(vanillaPacksTab);
|
||||
App.launcher.setVanillaPacksPanel(vanillaPacksTab);
|
||||
|
||||
featuredPacksTab = new PacksTab(true, false);
|
||||
App.settings.setFeaturedPacksPanel(featuredPacksTab);
|
||||
App.launcher.setFeaturedPacksPanel(featuredPacksTab);
|
||||
|
||||
packsTab = new PacksTab(false, false);
|
||||
App.settings.setPacksPanel(packsTab);
|
||||
App.launcher.setPacksPanel(packsTab);
|
||||
|
||||
instancesTab = new InstancesTab();
|
||||
App.settings.setInstancesPanel(instancesTab);
|
||||
App.launcher.setInstancesPanel(instancesTab);
|
||||
|
||||
serversTab = new ServersTab();
|
||||
App.settings.setServersPanel(serversTab);
|
||||
App.launcher.setServersPanel(serversTab);
|
||||
|
||||
accountsTab = new AccountsTab();
|
||||
toolsTab = new ToolsTab();
|
||||
|
@ -202,7 +202,7 @@ public final class LauncherFrame extends JFrame implements RelocalizationListene
|
|||
*/
|
||||
private void setupBottomBar() {
|
||||
bottomBar = new LauncherBottomBar();
|
||||
App.settings.setBottomBar(bottomBar);
|
||||
App.launcher.setBottomBar(bottomBar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -62,7 +62,7 @@ public final class TrayMenu extends JPopupMenu implements ConsoleCloseListener,
|
|||
|
||||
private void addActionListeners() {
|
||||
this.killMCButton.addActionListener(e -> SwingUtilities.invokeLater(() -> {
|
||||
if (App.settings.isMinecraftLaunched()) {
|
||||
if (App.launcher.isMinecraftLaunched()) {
|
||||
int ret = DialogManager.yesNoDialog().setTitle(GetText.tr("Kill Minecraft"))
|
||||
.setContent(new HTMLBuilder().center().text(GetText.tr(
|
||||
"Are you sure you want to kill the Minecraft process?<br/>Doing so can cause corruption of your saves"))
|
||||
|
@ -70,7 +70,7 @@ public final class TrayMenu extends JPopupMenu implements ConsoleCloseListener,
|
|||
.setType(DialogManager.ERROR).show();
|
||||
|
||||
if (ret == DialogManager.YES_OPTION) {
|
||||
App.settings.killMinecraft();
|
||||
App.launcher.killMinecraft();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -190,7 +190,7 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
|
||||
private void addActionListeners() {
|
||||
this.playButton.addActionListener(e -> {
|
||||
if (!App.settings.ignoreJavaOnInstanceLaunch() && instance.getJava() != null
|
||||
if (!App.settings.ignoreJavaOnInstanceLaunch && instance.getJava() != null
|
||||
&& !Java.getMinecraftJavaVersion().equalsIgnoreCase("Unknown") && !instance.getJava().conforms()) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("Cannot launch instance due to your Java version"))
|
||||
.setContent(new HTMLBuilder().center().text(GetText.tr(
|
||||
|
@ -210,7 +210,7 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
.addOption(GetText.tr("Don't Remind Me Again")).setType(DialogManager.INFO).show();
|
||||
|
||||
if (ret == 0) {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot update pack as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
@ -224,22 +224,22 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
instance.ignoreUpdate();
|
||||
}
|
||||
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.reinstallButton.addActionListener(e -> {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot reinstall pack as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
@ -249,7 +249,7 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
}
|
||||
});
|
||||
this.updateButton.addActionListener(e -> {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot update pack as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
@ -268,10 +268,10 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
.setType(DialogManager.INFO).show();
|
||||
|
||||
if (ret == DialogManager.YES_OPTION) {
|
||||
final JDialog dialog = new JDialog(App.settings.getParent(),
|
||||
final JDialog dialog = new JDialog(App.launcher.getParent(),
|
||||
GetText.tr("Backing Up {0}", instance.getName()), ModalityType.APPLICATION_MODAL);
|
||||
dialog.setSize(300, 100);
|
||||
dialog.setLocationRelativeTo(App.settings.getParent());
|
||||
dialog.setLocationRelativeTo(App.launcher.getParent());
|
||||
dialog.setResizable(false);
|
||||
|
||||
JPanel topPanel = new JPanel();
|
||||
|
@ -343,7 +343,7 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
final ProgressDialog dialog = new ProgressDialog(GetText.tr("Deleting Instance"), 0,
|
||||
GetText.tr("Deleting Instance. Please wait..."), null);
|
||||
dialog.addThread(new Thread(() -> {
|
||||
App.settings.removeInstance(instance);
|
||||
App.launcher.removeInstance(instance);
|
||||
dialog.close();
|
||||
App.TOASTER.pop(GetText.tr("Deleted Instance Successfully"));
|
||||
}));
|
||||
|
@ -366,7 +366,7 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
.addOption(GetText.tr("Don't Remind Me Again")).setType(DialogManager.INFO).show();
|
||||
|
||||
if (ret == 0) {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot update pack as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
@ -376,23 +376,23 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
new InstanceInstallerDialog(instance, true, false, null, null, true, null);
|
||||
}
|
||||
} else if (ret == 1 || ret == DialogManager.CLOSED_OPTION) {
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
} else if (ret == 2) {
|
||||
instance.ignoreUpdate();
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||
chooser.setAcceptAllFileFilterUsed(false);
|
||||
chooser.setFileFilter(new FileNameExtensionFilter("PNG Files", "png"));
|
||||
int ret = chooser.showOpenDialog(App.settings.getParent());
|
||||
int ret = chooser.showOpenDialog(App.launcher.getParent());
|
||||
if (ret == JFileChooser.APPROVE_OPTION) {
|
||||
File img = chooser.getSelectedFile();
|
||||
if (img.getAbsolutePath().endsWith(".png")) {
|
||||
|
@ -460,7 +460,7 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
.addOption(GetText.tr("Don't Remind Me Again")).setType(DialogManager.INFO).show();
|
||||
|
||||
if (ret == 0) {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(
|
||||
GetText.tr("Cannot update pack as you have no account selected."))
|
||||
|
@ -471,16 +471,16 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
|
|||
new InstanceInstallerDialog(instance, true, false, null, null, true, null);
|
||||
}
|
||||
} else if (ret == 1 || ret == DialogManager.CLOSED_OPTION) {
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
} else if (ret == 2) {
|
||||
instance.ignoreUpdate();
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
|
||||
private void addActionListeners() {
|
||||
this.playButton.addActionListener(e -> {
|
||||
if (!App.settings.ignoreJavaOnInstanceLaunch() && instance.launcher.java != null
|
||||
if (!App.settings.ignoreJavaOnInstanceLaunch && instance.launcher.java != null
|
||||
&& !Java.getMinecraftJavaVersion().equalsIgnoreCase("Unknown")
|
||||
&& !instance.launcher.java.conforms()) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("Cannot launch instance due to your Java version"))
|
||||
|
@ -230,7 +230,7 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
.addOption(GetText.tr("Don't Remind Me Again")).setType(DialogManager.INFO).show();
|
||||
|
||||
if (ret == 0) {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot update pack as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
@ -244,22 +244,22 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
instance.ignoreUpdate();
|
||||
}
|
||||
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.reinstallButton.addActionListener(e -> {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot reinstall pack as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
@ -270,7 +270,7 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
}
|
||||
});
|
||||
this.updateButton.addActionListener(e -> {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot update pack as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
@ -292,10 +292,10 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
.setType(DialogManager.INFO).show();
|
||||
|
||||
if (ret == DialogManager.YES_OPTION) {
|
||||
final JDialog dialog = new JDialog(App.settings.getParent(),
|
||||
final JDialog dialog = new JDialog(App.launcher.getParent(),
|
||||
GetText.tr("Backing Up {0}", instance.launcher.name), ModalityType.APPLICATION_MODAL);
|
||||
dialog.setSize(300, 100);
|
||||
dialog.setLocationRelativeTo(App.settings.getParent());
|
||||
dialog.setLocationRelativeTo(App.launcher.getParent());
|
||||
dialog.setResizable(false);
|
||||
|
||||
JPanel topPanel = new JPanel();
|
||||
|
@ -368,7 +368,7 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
final ProgressDialog dialog = new ProgressDialog(GetText.tr("Deleting Instance"), 0,
|
||||
GetText.tr("Deleting Instance. Please wait..."), null);
|
||||
dialog.addThread(new Thread(() -> {
|
||||
App.settings.removeInstance(instance);
|
||||
App.launcher.removeInstance(instance);
|
||||
dialog.close();
|
||||
App.TOASTER.pop(GetText.tr("Deleted Instance Successfully"));
|
||||
}));
|
||||
|
@ -396,7 +396,7 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
.addOption(GetText.tr("Don't Remind Me Again")).setType(DialogManager.INFO).show();
|
||||
|
||||
if (ret == 0) {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot update pack as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
@ -406,23 +406,23 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
new InstanceInstallerDialog(instance, true, false, null, null, true, null);
|
||||
}
|
||||
} else if (ret == 1 || ret == DialogManager.CLOSED_OPTION) {
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
} else if (ret == 2) {
|
||||
instance.ignoreUpdate();
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||
chooser.setAcceptAllFileFilterUsed(false);
|
||||
chooser.setFileFilter(new FileNameExtensionFilter("PNG Files", "png"));
|
||||
int ret = chooser.showOpenDialog(App.settings.getParent());
|
||||
int ret = chooser.showOpenDialog(App.launcher.getParent());
|
||||
if (ret == JFileChooser.APPROVE_OPTION) {
|
||||
File img = chooser.getSelectedFile();
|
||||
if (img.getAbsolutePath().endsWith(".png")) {
|
||||
|
@ -482,12 +482,12 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
});
|
||||
|
||||
cloneItem.addActionListener(e14 -> {
|
||||
String clonedName = JOptionPane.showInputDialog(App.settings.getParent(),
|
||||
String clonedName = JOptionPane.showInputDialog(App.launcher.getParent(),
|
||||
GetText.tr("Enter a new name for this cloned instance."),
|
||||
GetText.tr("Cloning Instance"), JOptionPane.INFORMATION_MESSAGE);
|
||||
if (clonedName != null && clonedName.length() >= 1
|
||||
&& App.settings.getInstanceByName(clonedName) == null
|
||||
&& App.settings.getInstanceBySafeName(clonedName.replaceAll("[^A-Za-z0-9]", "")) == null
|
||||
&& App.launcher.getInstanceByName(clonedName) == null
|
||||
&& App.launcher.getInstanceBySafeName(clonedName.replaceAll("[^A-Za-z0-9]", "")) == null
|
||||
&& clonedName.replaceAll("[^A-Za-z0-9]", "").length() >= 1 && !Files.exists(
|
||||
FileSystem.INSTANCES.resolve(clonedName.replaceAll("[^A-Za-z0-9]", "")))) {
|
||||
Analytics.sendEvent(instance.launcher.pack + " - " + instance.launcher.version, "Clone",
|
||||
|
@ -497,7 +497,7 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
final ProgressDialog dialog = new ProgressDialog(GetText.tr("Cloning Instance"), 0,
|
||||
GetText.tr("Cloning Instance. Please wait..."), null);
|
||||
dialog.addThread(new Thread(() -> {
|
||||
App.settings.cloneInstance(instance, newName);
|
||||
App.launcher.cloneInstance(instance, newName);
|
||||
dialog.close();
|
||||
App.TOASTER.pop(GetText.tr("Cloned Instance Successfully"));
|
||||
}));
|
||||
|
@ -547,7 +547,7 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
.addOption(GetText.tr("Don't Remind Me Again")).setType(DialogManager.INFO).show();
|
||||
|
||||
if (ret == 0) {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(
|
||||
GetText.tr("Cannot update pack as you have no account selected."))
|
||||
|
@ -558,16 +558,16 @@ public class InstanceV2Card extends CollapsiblePanel implements RelocalizationLi
|
|||
new InstanceInstallerDialog(instance, true, false, null, null, true, null);
|
||||
}
|
||||
} else if (ret == 1 || ret == DialogManager.CLOSED_OPTION) {
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
} else if (ret == 2) {
|
||||
instance.ignoreUpdate();
|
||||
if (!App.settings.isMinecraftLaunched()) {
|
||||
if (!App.launcher.isMinecraftLaunched()) {
|
||||
if (instance.launch()) {
|
||||
App.settings.setMinecraftLaunched(true);
|
||||
App.launcher.setMinecraftLaunched(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ public class PackCard extends CollapsiblePanel implements RelocalizationListener
|
|||
|
||||
private void addActionListeners() {
|
||||
this.newInstanceButton.addActionListener(e -> {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot create instance as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
@ -146,7 +146,7 @@ public class PackCard extends CollapsiblePanel implements RelocalizationListener
|
|||
});
|
||||
|
||||
this.createServerButton.addActionListener(e -> {
|
||||
if (App.settings.getAccount() == null) {
|
||||
if (App.launcher.account == null) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("No Account Selected"))
|
||||
.setContent(GetText.tr("Cannot create instance as you have no account selected."))
|
||||
.setType(DialogManager.ERROR).show();
|
||||
|
@ -173,7 +173,7 @@ public class PackCard extends CollapsiblePanel implements RelocalizationListener
|
|||
|
||||
this.removePackButton.addActionListener(e -> {
|
||||
Analytics.sendEvent(pack.getName(), "Remove", "Pack");
|
||||
App.settings.removePack(pack.getCode());
|
||||
App.launcher.removePack(pack.getCode());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -153,10 +153,10 @@ public class ServerCard extends CollapsiblePanel implements RelocalizationListen
|
|||
.setType(DialogManager.INFO).show();
|
||||
|
||||
if (ret == DialogManager.YES_OPTION) {
|
||||
final JDialog dialog = new JDialog(App.settings.getParent(), GetText.tr("Backing Up {0}", server.name),
|
||||
final JDialog dialog = new JDialog(App.launcher.getParent(), GetText.tr("Backing Up {0}", server.name),
|
||||
ModalityType.APPLICATION_MODAL);
|
||||
dialog.setSize(300, 100);
|
||||
dialog.setLocationRelativeTo(App.settings.getParent());
|
||||
dialog.setLocationRelativeTo(App.launcher.getParent());
|
||||
dialog.setResizable(false);
|
||||
|
||||
JPanel topPanel = new JPanel();
|
||||
|
@ -206,12 +206,12 @@ public class ServerCard extends CollapsiblePanel implements RelocalizationListen
|
|||
final ProgressDialog dialog = new ProgressDialog(GetText.tr("Deleting Server"), 0,
|
||||
GetText.tr("Deleting Server. Please wait..."), null);
|
||||
dialog.addThread(new Thread(() -> {
|
||||
App.settings.removeServer(server);
|
||||
App.launcher.removeServer(server);
|
||||
dialog.close();
|
||||
App.TOASTER.pop(GetText.tr("Deleted Server Successfully"));
|
||||
}));
|
||||
dialog.start();
|
||||
App.settings.reloadServersPanel();
|
||||
App.launcher.reloadServersPanel();
|
||||
}
|
||||
});
|
||||
this.openButton.addActionListener(e -> OS.openFileExplorer(server.getRoot()));
|
||||
|
@ -240,7 +240,7 @@ public class ServerCard extends CollapsiblePanel implements RelocalizationListen
|
|||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||
chooser.setAcceptAllFileFilterUsed(false);
|
||||
chooser.setFileFilter(new FileNameExtensionFilter("PNG Files", "png"));
|
||||
int ret = chooser.showOpenDialog(App.settings.getParent());
|
||||
int ret = chooser.showOpenDialog(App.launcher.getParent());
|
||||
if (ret == JFileChooser.APPROVE_OPTION) {
|
||||
File img = chooser.getSelectedFile();
|
||||
if (img.getAbsolutePath().endsWith(".png")) {
|
||||
|
|
|
@ -108,8 +108,8 @@ public class CollapsiblePanel extends JPanel implements ThemeListener {
|
|||
titleComponent = arrow;
|
||||
collapsed = false;
|
||||
commonConstructor();
|
||||
if (App.settings.getAccount() != null) {
|
||||
if (App.settings.getAccount().getCollapsedPacks().contains(pack.getName())) {
|
||||
if (App.launcher.account != null) {
|
||||
if (App.launcher.account.getCollapsedPacks().contains(pack.getName())) {
|
||||
setCollapsed(true);
|
||||
}
|
||||
}
|
||||
|
@ -128,8 +128,8 @@ public class CollapsiblePanel extends JPanel implements ThemeListener {
|
|||
titleComponent = arrow;
|
||||
collapsed = false;
|
||||
commonConstructor();
|
||||
if (App.settings.getAccount() != null) {
|
||||
if (App.settings.getAccount().getCollapsedInstances().contains(instance.getName())) {
|
||||
if (App.launcher.account != null) {
|
||||
if (App.launcher.account.getCollapsedInstances().contains(instance.getName())) {
|
||||
setCollapsed(true);
|
||||
}
|
||||
}
|
||||
|
@ -149,8 +149,8 @@ public class CollapsiblePanel extends JPanel implements ThemeListener {
|
|||
titleComponent = arrow;
|
||||
collapsed = false;
|
||||
commonConstructor();
|
||||
if (App.settings.getAccount() != null) {
|
||||
if (App.settings.getAccount().getCollapsedInstances().contains(instanceV2.launcher.name)) {
|
||||
if (App.launcher.account != null) {
|
||||
if (App.launcher.account.getCollapsedInstances().contains(instanceV2.launcher.name)) {
|
||||
setCollapsed(true);
|
||||
}
|
||||
}
|
||||
|
@ -163,8 +163,8 @@ public class CollapsiblePanel extends JPanel implements ThemeListener {
|
|||
titleComponent = arrow;
|
||||
collapsed = false;
|
||||
commonConstructor();
|
||||
if (App.settings.getAccount() != null) {
|
||||
if (App.settings.getAccount().getCollapsedServers().contains(server.name)) {
|
||||
if (App.launcher.account != null) {
|
||||
if (App.launcher.account.getCollapsedServers().contains(server.name)) {
|
||||
setCollapsed(true);
|
||||
}
|
||||
}
|
||||
|
@ -303,31 +303,31 @@ public class CollapsiblePanel extends JPanel implements ThemeListener {
|
|||
setCollapsed(!isCollapsed());
|
||||
if (pack != null) {
|
||||
Analytics.sendEvent(isCollapsed() ? 1 : 0, pack.getName(), "Collapse", "Pack");
|
||||
App.settings.setPackVisbility(pack, isCollapsed());
|
||||
App.launcher.setPackVisbility(pack, isCollapsed());
|
||||
} else if (instance != null) {
|
||||
Analytics.sendEvent(isCollapsed() ? 1 : 0, instance.getPackName() + " - " + instance.getVersion(),
|
||||
"Collapse", "Instance");
|
||||
App.settings.setInstanceVisbility(instance, isCollapsed());
|
||||
App.launcher.setInstanceVisbility(instance, isCollapsed());
|
||||
} else if (instanceV2 != null) {
|
||||
Analytics.sendEvent(isCollapsed() ? 1 : 0,
|
||||
instanceV2.launcher.pack + " - " + instanceV2.launcher.version, "Collapse", "InstanceV2");
|
||||
App.settings.setInstanceVisbility(instanceV2, isCollapsed());
|
||||
App.launcher.setInstanceVisbility(instanceV2, isCollapsed());
|
||||
} else if (server != null) {
|
||||
Analytics.sendEvent(isCollapsed() ? 1 : 0, server.pack + " - " + server.version, "Collapse", "Server");
|
||||
App.settings.setServerVisibility(server, isCollapsed());
|
||||
App.launcher.setServerVisibility(server, isCollapsed());
|
||||
}
|
||||
}
|
||||
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
setCollapsed(!isCollapsed());
|
||||
if (pack != null) {
|
||||
App.settings.setPackVisbility(pack, isCollapsed());
|
||||
App.launcher.setPackVisbility(pack, isCollapsed());
|
||||
} else if (instance != null) {
|
||||
App.settings.setInstanceVisbility(instance, isCollapsed());
|
||||
App.launcher.setInstanceVisbility(instance, isCollapsed());
|
||||
} else if (instanceV2 != null) {
|
||||
App.settings.setInstanceVisbility(instanceV2, isCollapsed());
|
||||
App.launcher.setInstanceVisbility(instanceV2, isCollapsed());
|
||||
} else if (server != null) {
|
||||
App.settings.setServerVisibility(server, isCollapsed());
|
||||
App.launcher.setServerVisibility(server, isCollapsed());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class ConsoleBottomBar extends BottomBar implements RelocalizationListene
|
|||
.setType(DialogManager.QUESTION).show();
|
||||
if (ret == DialogManager.YES_OPTION) {
|
||||
Analytics.sendEvent("KillMinecraft", "Launcher");
|
||||
App.settings.killMinecraft();
|
||||
App.launcher.killMinecraft();
|
||||
killMinecraftButton.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -70,7 +70,7 @@ public class LauncherBottomBar extends BottomBar implements RelocalizationListen
|
|||
gbc.insets = new Insets(0, 0, 0, 5);
|
||||
gbc.gridx++;
|
||||
leftSide.add(openFolder, gbc);
|
||||
|
||||
|
||||
gbc.gridx++;
|
||||
leftSide.add(updateData, gbc);
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class LauncherBottomBar extends BottomBar implements RelocalizationListen
|
|||
gbc.insets = new Insets(0, 0, 0, 5);
|
||||
middle.add(username, gbc);
|
||||
|
||||
username.setVisible(App.settings.getAccounts().size() != 0);
|
||||
username.setVisible(App.launcher.getAccounts().size() != 0);
|
||||
|
||||
add(leftSide, BorderLayout.WEST);
|
||||
add(middle, BorderLayout.CENTER);
|
||||
|
@ -97,8 +97,8 @@ public class LauncherBottomBar extends BottomBar implements RelocalizationListen
|
|||
GetText.tr("Checking For Updates"), "Aborting Update Check!");
|
||||
dialog.addThread(new Thread(() -> {
|
||||
Analytics.sendEvent("UpdateData", "Launcher");
|
||||
if (App.settings.checkForUpdatedFiles()) {
|
||||
App.settings.reloadLauncherData();
|
||||
if (App.launcher.checkForUpdatedFiles()) {
|
||||
App.launcher.reloadLauncherData();
|
||||
}
|
||||
dialog.close();
|
||||
}));
|
||||
|
@ -108,7 +108,7 @@ public class LauncherBottomBar extends BottomBar implements RelocalizationListen
|
|||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||
if (!dontSave) {
|
||||
Analytics.sendEvent("Switch", "Account");
|
||||
App.settings.switchAccount((Account) username.getSelectedItem());
|
||||
App.launcher.switchAccount((Account) username.getSelectedItem());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -132,11 +132,11 @@ public class LauncherBottomBar extends BottomBar implements RelocalizationListen
|
|||
username = new JComboBox<>();
|
||||
username.setRenderer(new AccountsDropDownRenderer());
|
||||
|
||||
for (Account account : App.settings.getAccounts()) {
|
||||
for (Account account : App.launcher.getAccounts()) {
|
||||
username.addItem(account);
|
||||
}
|
||||
|
||||
Account active = App.settings.getAccount();
|
||||
Account active = App.launcher.account;
|
||||
|
||||
if (active != null) {
|
||||
username.setSelectedItem(active);
|
||||
|
@ -147,15 +147,15 @@ public class LauncherBottomBar extends BottomBar implements RelocalizationListen
|
|||
dontSave = true;
|
||||
username.removeAllItems();
|
||||
|
||||
for (Account account : App.settings.getAccounts()) {
|
||||
for (Account account : App.launcher.getAccounts()) {
|
||||
username.addItem(account);
|
||||
}
|
||||
|
||||
if (App.settings.getAccount() != null) {
|
||||
username.setSelectedItem(App.settings.getAccount());
|
||||
if (App.launcher.account != null) {
|
||||
username.setSelectedItem(App.launcher.account);
|
||||
}
|
||||
|
||||
username.setVisible(App.settings.getAccounts().size() != 0);
|
||||
username.setVisible(App.launcher.getAccounts().size() != 0);
|
||||
|
||||
dontSave = false;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public final class PackImagePanel extends JPanel {
|
|||
int y = (this.getHeight() - 150) / 2;
|
||||
g2.drawImage(this.image, 0, y, 300, 150, null);
|
||||
|
||||
if (App.settings.enabledPackTags()) {
|
||||
if (App.settings.enablePackTags) {
|
||||
String text;
|
||||
Color colour;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class AddCursePackDialog extends JDialog {
|
|||
private JButton addButton;
|
||||
|
||||
public AddCursePackDialog() {
|
||||
super(App.settings.getParent(), GetText.tr("Add Curse Pack"), ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), GetText.tr("Add Curse Pack"), ModalityType.APPLICATION_MODAL);
|
||||
setSize(450, 200);
|
||||
setLocationRelativeTo(null);
|
||||
setLayout(new BorderLayout());
|
||||
|
|
|
@ -193,13 +193,13 @@ public class AddEditServerForCheckerDialog extends JDialog implements ActionList
|
|||
App.TOASTER.pop(
|
||||
(this.serverEditing == null ? GetText.tr("Server Added") : GetText.tr("Server Edited")));
|
||||
if (this.serverEditing == null) {
|
||||
App.settings.addCheckingServer(new MinecraftServer(name, host, port, qv));
|
||||
App.launcher.addCheckingServer(new MinecraftServer(name, host, port, qv));
|
||||
} else {
|
||||
this.serverEditing.setName(name);
|
||||
this.serverEditing.setHost(host);
|
||||
this.serverEditing.setPort(port);
|
||||
this.serverEditing.setQueryVersion(qv);
|
||||
App.settings.saveCheckingServers();
|
||||
App.launcher.saveCheckingServers();
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public final class AddModsDialog extends JDialog {
|
|||
|
||||
public AddModsDialog(Instance instance) {
|
||||
// #. {0} is the name of the mod we're installing
|
||||
super(App.settings.getParent(), GetText.tr("Adding Mods For {0}", instance.getName()),
|
||||
super(App.launcher.getParent(), GetText.tr("Adding Mods For {0}", instance.getName()),
|
||||
ModalityType.APPLICATION_MODAL);
|
||||
this.instance = instance;
|
||||
|
||||
|
@ -101,13 +101,13 @@ public final class AddModsDialog extends JDialog {
|
|||
this.loadDefaultMods();
|
||||
|
||||
this.pack();
|
||||
this.setLocationRelativeTo(App.settings.getParent());
|
||||
this.setLocationRelativeTo(App.launcher.getParent());
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public AddModsDialog(InstanceV2 instanceV2) {
|
||||
// #. {0} is the name of the mod we're installing
|
||||
super(App.settings.getParent(), GetText.tr("Adding Mods For {0}", instanceV2.launcher.name),
|
||||
super(App.launcher.getParent(), GetText.tr("Adding Mods For {0}", instanceV2.launcher.name),
|
||||
ModalityType.APPLICATION_MODAL);
|
||||
this.instanceV2 = instanceV2;
|
||||
|
||||
|
@ -131,7 +131,7 @@ public final class AddModsDialog extends JDialog {
|
|||
this.loadDefaultMods();
|
||||
|
||||
this.pack();
|
||||
this.setLocationRelativeTo(App.settings.getParent());
|
||||
this.setLocationRelativeTo(App.launcher.getParent());
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ public final class AddModsDialog extends JDialog {
|
|||
} else if (((ComboItem) sectionComboBox.getSelectedItem()).getValue().equals("Worlds")) {
|
||||
setMods(CurseApi
|
||||
.searchWorlds(
|
||||
App.settings.disabledAddModRestrictions() ? null
|
||||
App.settings.disableAddModRestrictions ? null
|
||||
: (this.instanceV2 != null ? this.instanceV2.id
|
||||
: this.instance.getMinecraftVersion()),
|
||||
query, page, ((ComboItem) sortComboBox.getSelectedItem()).getValue()));
|
||||
|
@ -280,13 +280,13 @@ public final class AddModsDialog extends JDialog {
|
|||
if ((this.instanceV2 != null ? this.instanceV2.launcher.loaderVersion
|
||||
: this.instance.getLoaderVersion()).isFabric()) {
|
||||
setMods(CurseApi.searchModsForFabric(
|
||||
App.settings.disabledAddModRestrictions() ? null
|
||||
App.settings.disableAddModRestrictions ? null
|
||||
: (this.instanceV2 != null ? this.instanceV2.id
|
||||
: this.instance.getMinecraftVersion()),
|
||||
query, page, ((ComboItem) sortComboBox.getSelectedItem()).getValue()));
|
||||
} else {
|
||||
setMods(CurseApi.searchMods(
|
||||
App.settings.disabledAddModRestrictions() ? null
|
||||
App.settings.disableAddModRestrictions ? null
|
||||
: (this.instanceV2 != null ? this.instanceV2.id
|
||||
: this.instance.getMinecraftVersion()),
|
||||
query, page, ((ComboItem) sortComboBox.getSelectedItem()).getValue()));
|
||||
|
|
|
@ -88,8 +88,8 @@ public class AddPackDialog extends JDialog {
|
|||
bottom.setLayout(new FlowLayout());
|
||||
saveButton = new JButton(GetText.tr("Add"));
|
||||
saveButton.addActionListener(e -> {
|
||||
if (App.settings.semiPublicPackExistsFromCode(packCode.getText())) {
|
||||
if (App.settings.addPack(packCode.getText())) {
|
||||
if (App.launcher.semiPublicPackExistsFromCode(packCode.getText())) {
|
||||
if (App.launcher.addPack(packCode.getText())) {
|
||||
DialogManager.okDialog().setParent(AddPackDialog.this).setTitle(GetText.tr("Pack Added"))
|
||||
.setContent(GetText.tr("The pack has been added!")).setType(DialogManager.INFO).show();
|
||||
} else {
|
||||
|
|
|
@ -68,7 +68,7 @@ public class CurseModFileSelectorDialog extends JDialog {
|
|||
private List<CurseFile> files = new ArrayList<>();
|
||||
|
||||
public CurseModFileSelectorDialog(CurseMod mod, Instance instance) {
|
||||
super(App.settings.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
|
||||
this.mod = mod;
|
||||
this.instance = instance;
|
||||
|
@ -77,7 +77,7 @@ public class CurseModFileSelectorDialog extends JDialog {
|
|||
}
|
||||
|
||||
public CurseModFileSelectorDialog(CurseMod mod, Instance instance, int installedFileId) {
|
||||
super(App.settings.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
|
||||
this.mod = mod;
|
||||
this.instance = instance;
|
||||
|
@ -87,7 +87,7 @@ public class CurseModFileSelectorDialog extends JDialog {
|
|||
}
|
||||
|
||||
public CurseModFileSelectorDialog(CurseMod mod, InstanceV2 instanceV2) {
|
||||
super(App.settings.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
|
||||
this.mod = mod;
|
||||
this.instanceV2 = instanceV2;
|
||||
|
@ -96,7 +96,7 @@ public class CurseModFileSelectorDialog extends JDialog {
|
|||
}
|
||||
|
||||
public CurseModFileSelectorDialog(CurseMod mod, InstanceV2 instanceV2, int installedFileId) {
|
||||
super(App.settings.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
|
||||
this.mod = mod;
|
||||
this.instanceV2 = instanceV2;
|
||||
|
@ -112,7 +112,7 @@ public class CurseModFileSelectorDialog extends JDialog {
|
|||
setTitle(GetText.tr("Installing {0}", mod.name));
|
||||
|
||||
setSize(500, 200);
|
||||
setLocationRelativeTo(App.settings.getParent());
|
||||
setLocationRelativeTo(App.launcher.getParent());
|
||||
setLayout(new BorderLayout());
|
||||
setResizable(false);
|
||||
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
|
@ -240,7 +240,7 @@ public class CurseModFileSelectorDialog extends JDialog {
|
|||
(dependencies.size() / 2) + 1));
|
||||
|
||||
setSize(550, 400);
|
||||
setLocationRelativeTo(App.settings.getParent());
|
||||
setLocationRelativeTo(App.launcher.getParent());
|
||||
|
||||
dependenciesPanel.setVisible(true);
|
||||
|
||||
|
@ -272,8 +272,8 @@ public class CurseModFileSelectorDialog extends JDialog {
|
|||
Stream<CurseFile> curseFilesStream = CurseApi.getFilesForMod(mod.id).stream()
|
||||
.sorted(Comparator.comparingInt((CurseFile file) -> file.id).reversed());
|
||||
|
||||
if (!App.settings.disabledAddModRestrictions()) {
|
||||
curseFilesStream = curseFilesStream.filter(file -> App.settings.disabledAddModRestrictions()
|
||||
if (!App.settings.disableAddModRestrictions) {
|
||||
curseFilesStream = curseFilesStream.filter(file -> App.settings.disableAddModRestrictions
|
||||
|| mod.categorySection.gameCategoryId == Constants.CURSE_RESOURCE_PACKS_SECTION_ID
|
||||
|| file.gameVersion.contains(
|
||||
this.instanceV2 != null ? this.instanceV2.id : this.instance.getMinecraftVersion()));
|
||||
|
@ -288,7 +288,7 @@ public class CurseModFileSelectorDialog extends JDialog {
|
|||
}
|
||||
|
||||
// try to filter out non compatable mods (Forge on Fabric and vice versa)
|
||||
if (App.settings.disabledAddModRestrictions()) {
|
||||
if (App.settings.disableAddModRestrictions) {
|
||||
files.stream().forEach(version -> filesDropdown.addItem(version));
|
||||
} else {
|
||||
files.stream().filter(version -> {
|
||||
|
|
|
@ -74,12 +74,12 @@ public class EditModsDialog extends JDialog {
|
|||
private ArrayList<ModsJCheckBox> enabledMods, disabledMods;
|
||||
|
||||
public EditModsDialog(Instance instance) {
|
||||
super(App.settings.getParent(),
|
||||
super(App.launcher.getParent(),
|
||||
// #. {0} is the name of the instance
|
||||
GetText.tr("Editing Mods For {0}", instance.getName()), ModalityType.APPLICATION_MODAL);
|
||||
this.instance = instance;
|
||||
setSize(550, 450);
|
||||
setLocationRelativeTo(App.settings.getParent());
|
||||
setLocationRelativeTo(App.launcher.getParent());
|
||||
setLayout(new BorderLayout());
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
|
@ -98,12 +98,12 @@ public class EditModsDialog extends JDialog {
|
|||
}
|
||||
|
||||
public EditModsDialog(InstanceV2 instanceV2) {
|
||||
super(App.settings.getParent(),
|
||||
super(App.launcher.getParent(),
|
||||
// #. {0} is the name of the instance
|
||||
GetText.tr("Editing Mods For {0}", instanceV2.launcher.name), ModalityType.APPLICATION_MODAL);
|
||||
this.instanceV2 = instanceV2;
|
||||
setSize(550, 450);
|
||||
setLocationRelativeTo(App.settings.getParent());
|
||||
setLocationRelativeTo(App.launcher.getParent());
|
||||
setLayout(new BorderLayout());
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
|
@ -217,7 +217,7 @@ public class EditModsDialog extends JDialog {
|
|||
addButton.addActionListener(e -> {
|
||||
boolean usesCoreMods = false;
|
||||
try {
|
||||
usesCoreMods = App.settings.getMinecraftVersion(
|
||||
usesCoreMods = App.launcher.getMinecraftVersion(
|
||||
instanceV2 != null ? instanceV2.id : this.instance.getMinecraftVersion()).coremods;
|
||||
} catch (InvalidMinecraftVersion e1) {
|
||||
LogManager.logStackTrace(e1);
|
||||
|
@ -519,7 +519,7 @@ public class EditModsDialog extends JDialog {
|
|||
if (this.instanceV2 != null) {
|
||||
this.instanceV2.save();
|
||||
} else {
|
||||
App.settings.saveInstances();
|
||||
App.launcher.saveInstances();
|
||||
}
|
||||
|
||||
enabledModsPanel.removeAll();
|
||||
|
|
|
@ -67,7 +67,7 @@ public class FileChooserDialog extends JDialog {
|
|||
|
||||
public FileChooserDialog(String title, String labelName, String bottomText, String selectorText,
|
||||
String[] subOptions, String[] options) {
|
||||
super(App.settings.getParent(), title, ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), title, ModalityType.APPLICATION_MODAL);
|
||||
this.fileOptions = options;
|
||||
setSize(400, 175);
|
||||
setLocationRelativeTo(null);
|
||||
|
@ -126,7 +126,7 @@ public class FileChooserDialog extends JDialog {
|
|||
return false;
|
||||
}
|
||||
});
|
||||
fileChooser.showOpenDialog(App.settings.getParent());
|
||||
fileChooser.showOpenDialog(App.launcher.getParent());
|
||||
filesChosen = fileChooser.getSelectedFiles();
|
||||
if (filesChosen != null && filesChosen.length >= 1) {
|
||||
if (filesChosen.length == 1) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public class FileTypeDialog extends JDialog {
|
|||
private boolean closed = false;
|
||||
|
||||
public FileTypeDialog(String title, String labelName, String bottomText, String selectorText, String[] subOptions) {
|
||||
super(App.settings.getParent(), title, ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), title, ModalityType.APPLICATION_MODAL);
|
||||
setSize(400, 175);
|
||||
setLocationRelativeTo(null);
|
||||
setLayout(new BorderLayout());
|
||||
|
|
|
@ -64,7 +64,7 @@ public class InstanceExportDialog extends JDialog {
|
|||
final GridBagConstraints gbc = new GridBagConstraints();
|
||||
|
||||
public InstanceExportDialog(InstanceV2 instance) {
|
||||
super(App.settings.getParent(), GetText.tr("Export {0}", instance.launcher.name),
|
||||
super(App.launcher.getParent(), GetText.tr("Export {0}", instance.launcher.name),
|
||||
ModalityType.APPLICATION_MODAL);
|
||||
this.instance = instance;
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class InstanceExportDialog extends JDialog {
|
|||
|
||||
private void setupComponents() {
|
||||
setSize(550, 400);
|
||||
setLocationRelativeTo(App.settings.getParent());
|
||||
setLocationRelativeTo(App.launcher.getParent());
|
||||
setLayout(new BorderLayout());
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
|
@ -119,7 +119,7 @@ public class InstanceExportDialog extends JDialog {
|
|||
gbc.insets = UIConstants.LABEL_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
final JTextField author = new JTextField(30);
|
||||
author.setText(App.settings.getAccount().getMinecraftUsername());
|
||||
author.setText(App.launcher.account.getMinecraftUsername());
|
||||
topPanel.add(author, gbc);
|
||||
|
||||
// Export File
|
||||
|
|
|
@ -120,7 +120,7 @@ public class InstanceInstallerDialog extends JDialog {
|
|||
public InstanceInstallerDialog(Object object, final boolean isUpdate, final boolean isServer,
|
||||
final PackVersion autoInstallVersion, final String shareCode, final boolean showModsChooser,
|
||||
File manifestFile) {
|
||||
super(App.settings.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
|
||||
this.isUpdate = isUpdate;
|
||||
this.autoInstallVersion = autoInstallVersion;
|
||||
|
@ -162,7 +162,7 @@ public class InstanceInstallerDialog extends JDialog {
|
|||
packVersion.version = curseManifest.version;
|
||||
|
||||
try {
|
||||
packVersion.minecraftVersion = App.settings.getMinecraftVersion(curseManifest.minecraft.version);
|
||||
packVersion.minecraftVersion = App.launcher.getMinecraftVersion(curseManifest.minecraft.version);
|
||||
} catch (InvalidMinecraftVersion e) {
|
||||
LogManager.error(e.getMessage());
|
||||
return;
|
||||
|
@ -184,7 +184,7 @@ public class InstanceInstallerDialog extends JDialog {
|
|||
setTitle(GetText.tr("Reinstalling {0}", instanceV2.launcher.name));
|
||||
}
|
||||
setSize(450, 240);
|
||||
setLocationRelativeTo(App.settings.getParent());
|
||||
setLocationRelativeTo(App.launcher.getParent());
|
||||
setLayout(new BorderLayout());
|
||||
setResizable(false);
|
||||
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
|
@ -309,7 +309,7 @@ public class InstanceInstallerDialog extends JDialog {
|
|||
bottom.setLayout(new FlowLayout());
|
||||
install.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (!isReinstall && !isServer && App.settings.isInstance(nameField.getText())) {
|
||||
if (!isReinstall && !isServer && App.launcher.isInstance(nameField.getText())) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("Error"))
|
||||
.setContent(new HTMLBuilder().center().text(GetText
|
||||
.tr("An instance already exists with that name.<br/><br/>Rename it and try again."))
|
||||
|
@ -322,7 +322,7 @@ public class InstanceInstallerDialog extends JDialog {
|
|||
.text(GetText.tr("Instance name is invalid. It must contain at least 1 letter or number."))
|
||||
.build()).setType(DialogManager.ERROR).show();
|
||||
return;
|
||||
} else if (!isReinstall && isServer && App.settings.isServer(nameField.getText())) {
|
||||
} else if (!isReinstall && isServer && App.launcher.isServer(nameField.getText())) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("Error"))
|
||||
.setContent(new HTMLBuilder().center().text(GetText
|
||||
.tr("A server already exists with that name.<br/><br/>Rename it and try again."))
|
||||
|
@ -338,7 +338,7 @@ public class InstanceInstallerDialog extends JDialog {
|
|||
}
|
||||
|
||||
final PackVersion version = (PackVersion) versionsDropDown.getSelectedItem();
|
||||
final JDialog dialog = new JDialog(App.settings.getParent(), isReinstall ? (
|
||||
final JDialog dialog = new JDialog(App.launcher.getParent(), isReinstall ? (
|
||||
// #. {0} is the name of the pack the user is installing
|
||||
isServer ? GetText.tr("Reinstalling {0} Server", pack.getName())
|
||||
// #. {0} is the name of the pack the user is installing
|
||||
|
@ -347,7 +347,7 @@ public class InstanceInstallerDialog extends JDialog {
|
|||
isServer ? GetText.tr("Installing {0} Server", pack.getName())
|
||||
// #. {0} is the name of the pack the user is installing
|
||||
: GetText.tr("Installing {0}", pack.getName())), ModalityType.DOCUMENT_MODAL);
|
||||
dialog.setLocationRelativeTo(App.settings.getParent());
|
||||
dialog.setLocationRelativeTo(App.launcher.getParent());
|
||||
dialog.setSize(300, 100);
|
||||
dialog.setResizable(false);
|
||||
|
||||
|
@ -401,7 +401,7 @@ public class InstanceInstallerDialog extends JDialog {
|
|||
|
||||
if (instanceIsCorrupt) {
|
||||
if (instance != null) {
|
||||
App.settings.setInstanceUnplayable(instance);
|
||||
App.launcher.setInstanceUnplayable(instance);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -449,12 +449,12 @@ public class InstanceInstallerDialog extends JDialog {
|
|||
}
|
||||
|
||||
if (isServer) {
|
||||
App.settings.reloadServersPanel();
|
||||
App.launcher.reloadServersPanel();
|
||||
} else {
|
||||
App.settings.reloadInstancesPanel();
|
||||
App.launcher.reloadInstancesPanel();
|
||||
}
|
||||
|
||||
if (pack.isLoggingEnabled() && App.settings.enableLogs() && !version.isDev) {
|
||||
if (pack.isLoggingEnabled() && App.settings.enableLogs && !version.isDev) {
|
||||
if (isServer) {
|
||||
pack.addServerInstall(version.version);
|
||||
} else if (isUpdate) {
|
||||
|
@ -476,7 +476,7 @@ public class InstanceInstallerDialog extends JDialog {
|
|||
|
||||
if (instanceIsCorrupt) {
|
||||
if (instance != null) {
|
||||
App.settings.setInstanceUnplayable(instance);
|
||||
App.launcher.setInstanceUnplayable(instance);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -73,7 +73,7 @@ public class InstanceSettingsDialog extends JDialog {
|
|||
|
||||
public InstanceSettingsDialog(Instance instance) {
|
||||
// #. {0} is the name of the instance
|
||||
super(App.settings.getParent(), GetText.tr("{0} Settings", instance.getName()), ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), GetText.tr("{0} Settings", instance.getName()), ModalityType.APPLICATION_MODAL);
|
||||
this.instance = instance;
|
||||
|
||||
Analytics.sendScreenView("Instance Settings Dialog");
|
||||
|
@ -90,7 +90,7 @@ public class InstanceSettingsDialog extends JDialog {
|
|||
}
|
||||
|
||||
public InstanceSettingsDialog(InstanceV2 instanceV2) {
|
||||
super(App.settings.getParent(), GetText.tr("{0} Settings", instanceV2.launcher.name),
|
||||
super(App.launcher.getParent(), GetText.tr("{0} Settings", instanceV2.launcher.name),
|
||||
ModalityType.APPLICATION_MODAL);
|
||||
this.instanceV2 = instanceV2;
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class InstanceSettingsDialog extends JDialog {
|
|||
private void setupComponents() {
|
||||
int systemRam = OS.getSystemRam();
|
||||
setSize(750, 350);
|
||||
setLocationRelativeTo(App.settings.getParent());
|
||||
setLocationRelativeTo(App.launcher.getParent());
|
||||
setLayout(new BorderLayout());
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
|
@ -145,7 +145,7 @@ public class InstanceSettingsDialog extends JDialog {
|
|||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel initialMemoryModel = new SpinnerNumberModel(
|
||||
getIfNotNull(this.instanceV2 != null ? this.instanceV2.launcher.initialMemory
|
||||
: instance.getSettings().getInitialMemory(), App.settings.getInitialMemory()),
|
||||
: instance.getSettings().getInitialMemory(), App.settings.initialMemory),
|
||||
null, null, 128);
|
||||
initialMemoryModel.setMinimum(128);
|
||||
initialMemoryModel.setMaximum((systemRam == 0 ? null : systemRam));
|
||||
|
@ -176,7 +176,7 @@ public class InstanceSettingsDialog extends JDialog {
|
|||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel maximumMemoryModel = new SpinnerNumberModel(
|
||||
getIfNotNull(this.instanceV2 != null ? this.instanceV2.launcher.maximumMemory
|
||||
: instance.getSettings().getMaximumMemory(), App.settings.getMaximumMemory()),
|
||||
: instance.getSettings().getMaximumMemory(), App.settings.maximumMemory),
|
||||
null, null, 512);
|
||||
maximumMemoryModel.setMinimum(512);
|
||||
maximumMemoryModel.setMaximum((systemRam == 0 ? null : systemRam));
|
||||
|
@ -198,7 +198,7 @@ public class InstanceSettingsDialog extends JDialog {
|
|||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel permGenModel = new SpinnerNumberModel(getIfNotNull(
|
||||
this.instanceV2 != null ? this.instanceV2.launcher.permGen : instance.getSettings().getPermGen(),
|
||||
App.settings.getPermGen()), null, null, 32);
|
||||
App.settings.metaspace), null, null, 32);
|
||||
permGenModel.setMinimum(32);
|
||||
permGenModel.setMaximum((systemRam == 0 ? null : systemRam));
|
||||
final JSpinner permGen = new JSpinner(permGenModel);
|
||||
|
@ -233,7 +233,7 @@ public class InstanceSettingsDialog extends JDialog {
|
|||
final JTextField javaPath = new JTextField(32);
|
||||
javaPath.setText(getIfNotNull(
|
||||
this.instanceV2 != null ? this.instanceV2.launcher.javaPath : instance.getSettings().getJavaPath(),
|
||||
App.settings.getJavaPath()));
|
||||
App.settings.javaPath));
|
||||
JButton javaPathResetButton = new JButton(GetText.tr("Reset"));
|
||||
javaPathResetButton.addActionListener(e -> javaPath.setText(OS.getDefaultJavaPath()));
|
||||
JButton javaBrowseButton = new JButton(GetText.tr("Browse"));
|
||||
|
@ -255,7 +255,7 @@ public class InstanceSettingsDialog extends JDialog {
|
|||
Java.getInstalledJavas().stream().forEach(installedJavas::addItem);
|
||||
|
||||
installedJavas.setSelectedItem(Java.getInstalledJavas().stream()
|
||||
.filter(javaInfo -> javaInfo.rootPath.equalsIgnoreCase(App.settings.getJavaPath())).findFirst()
|
||||
.filter(javaInfo -> javaInfo.rootPath.equalsIgnoreCase(App.settings.javaPath)).findFirst()
|
||||
.orElse(null));
|
||||
|
||||
installedJavas
|
||||
|
@ -297,11 +297,11 @@ public class InstanceSettingsDialog extends JDialog {
|
|||
|
||||
final JTextArea javaParameters = new JTextArea(6, 40);
|
||||
javaParameters.setText(getIfNotNull(this.instanceV2 != null ? this.instanceV2.launcher.javaArguments
|
||||
: instance.getSettings().getJavaArguments(), App.settings.getJavaParameters()));
|
||||
: instance.getSettings().getJavaArguments(), App.settings.javaParameters));
|
||||
javaParameters.setLineWrap(true);
|
||||
javaParameters.setWrapStyleWord(true);
|
||||
JButton javaParametersResetButton = new JButton(GetText.tr("Reset"));
|
||||
javaParametersResetButton.addActionListener(e -> javaParameters.setText(App.settings.getJavaParameters()));
|
||||
javaParametersResetButton.addActionListener(e -> javaParameters.setText(App.settings.javaParameters));
|
||||
|
||||
javaParametersPanel.add(javaParameters);
|
||||
javaParametersPanel.add(Box.createHorizontalStrut(5));
|
||||
|
@ -352,28 +352,28 @@ public class InstanceSettingsDialog extends JDialog {
|
|||
private void saveSettings(Integer initialMemory, Integer maximumMemory, Integer permGen, String javaPath,
|
||||
String javaParameters) {
|
||||
if (this.instanceV2 != null) {
|
||||
this.instanceV2.launcher.initialMemory = (initialMemory == App.settings.getInitialMemory() ? null
|
||||
this.instanceV2.launcher.initialMemory = (initialMemory == App.settings.initialMemory ? null
|
||||
: initialMemory);
|
||||
this.instanceV2.launcher.maximumMemory = (maximumMemory == App.settings.getMaximumMemory() ? null
|
||||
this.instanceV2.launcher.maximumMemory = (maximumMemory == App.settings.maximumMemory ? null
|
||||
: maximumMemory);
|
||||
this.instanceV2.launcher.permGen = (permGen == App.settings.getPermGen() ? null : permGen);
|
||||
this.instanceV2.launcher.javaPath = (javaPath.equals(App.settings.getJavaPath()) ? null : javaPath);
|
||||
this.instanceV2.launcher.javaArguments = (javaParameters.equals(App.settings.getJavaParameters()) ? null
|
||||
this.instanceV2.launcher.permGen = (permGen == App.settings.metaspace ? null : permGen);
|
||||
this.instanceV2.launcher.javaPath = (javaPath.equals(App.settings.javaPath) ? null : javaPath);
|
||||
this.instanceV2.launcher.javaArguments = (javaParameters.equals(App.settings.javaParameters) ? null
|
||||
: javaParameters);
|
||||
this.instanceV2.save();
|
||||
} else {
|
||||
InstanceSettings instanceSettings = instance.getSettings();
|
||||
|
||||
instanceSettings.setInitialMemory(initialMemory == App.settings.getInitialMemory() ? null : initialMemory);
|
||||
instanceSettings.setInitialMemory(initialMemory == App.settings.initialMemory ? null : initialMemory);
|
||||
|
||||
instanceSettings.setMaximumMemory(maximumMemory == App.settings.getMaximumMemory() ? null : maximumMemory);
|
||||
instanceSettings.setMaximumMemory(maximumMemory == App.settings.maximumMemory ? null : maximumMemory);
|
||||
|
||||
instanceSettings.setPermGen(permGen == App.settings.getPermGen() ? null : permGen);
|
||||
instanceSettings.setPermGen(permGen == App.settings.metaspace ? null : permGen);
|
||||
|
||||
instanceSettings.setJavaPath(javaPath.equals(App.settings.getJavaPath()) ? null : javaPath);
|
||||
instanceSettings.setJavaPath(javaPath.equals(App.settings.javaPath) ? null : javaPath);
|
||||
|
||||
instanceSettings
|
||||
.setJavaArguments(javaParameters.equals(App.settings.getJavaParameters()) ? null : javaParameters);
|
||||
.setJavaArguments(javaParameters.equals(App.settings.javaParameters) ? null : javaParameters);
|
||||
|
||||
this.instance.save();
|
||||
}
|
||||
|
|
|
@ -63,13 +63,13 @@ public class ModsChooser extends JDialog {
|
|||
private boolean wasClosed = false;
|
||||
|
||||
public ModsChooser(InstanceInstaller installerr) {
|
||||
super(App.settings.getParent(), GetText.tr("Select Mods To Install"), ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), GetText.tr("Select Mods To Install"), ModalityType.APPLICATION_MODAL);
|
||||
this.installer = installerr;
|
||||
|
||||
Analytics.sendScreenView("Mods Chooser Dialog");
|
||||
|
||||
setIconImage(Utils.getImage("/assets/image/Icon.png"));
|
||||
setLocationRelativeTo(App.settings.getParent());
|
||||
setLocationRelativeTo(App.launcher.getParent());
|
||||
setLayout(new BorderLayout());
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ProgressDialog extends JDialog implements NetworkProgressable {
|
|||
private double downloadedBytes = 0; // Total number of bytes downloaded
|
||||
|
||||
public ProgressDialog(String title, int initMax, String initLabelText, String initClosedLogMessage) {
|
||||
super(App.settings.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), ModalityType.APPLICATION_MODAL);
|
||||
this.labelText = initLabelText;
|
||||
this.max = initMax;
|
||||
this.closedLogMessage = initClosedLogMessage;
|
||||
|
@ -58,7 +58,7 @@ public class ProgressDialog extends JDialog implements NetworkProgressable {
|
|||
setIconImage(Utils.getImage("/assets/image/Icon.png"));
|
||||
setSize(300, 100);
|
||||
setTitle(title);
|
||||
setLocationRelativeTo(App.settings.getParent());
|
||||
setLocationRelativeTo(App.launcher.getParent());
|
||||
setLayout(new BorderLayout());
|
||||
setResizable(false);
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public class RenameInstanceDialog extends JDialog {
|
|||
bottom.setLayout(new FlowLayout());
|
||||
saveButton = new JButton(GetText.tr("Save"));
|
||||
saveButton.addActionListener(e -> {
|
||||
if (App.settings.isInstance(instanceName.getText())) {
|
||||
if (App.launcher.isInstance(instanceName.getText())) {
|
||||
DialogManager.okDialog().setParent(RenameInstanceDialog.this).setTitle(GetText.tr("Error"))
|
||||
.setContent(
|
||||
GetText.tr("There is already an instance called {0}.<br/><br/>Rename it and try again.",
|
||||
|
@ -150,10 +150,10 @@ public class RenameInstanceDialog extends JDialog {
|
|||
.setType(DialogManager.ERROR).show();
|
||||
} else {
|
||||
if (this.instanceV2 != null && instanceV2.rename(instanceName.getText())) {
|
||||
App.settings.reloadInstancesPanel();
|
||||
App.launcher.reloadInstancesPanel();
|
||||
} else if (this.instance != null && instance.rename(instanceName.getText())) {
|
||||
App.settings.saveInstances();
|
||||
App.settings.reloadInstancesPanel();
|
||||
App.launcher.saveInstances();
|
||||
App.launcher.reloadInstancesPanel();
|
||||
} else {
|
||||
LogManager.error("Unknown Error Occurred While Renaming Instance!");
|
||||
DialogManager.okDialog().setParent(RenameInstanceDialog.this).setTitle(GetText.tr("Error"))
|
||||
|
|
|
@ -123,8 +123,9 @@ public class SetupDialog extends JDialog implements RelocalizationListener {
|
|||
saveButton = new JButton(GetText.tr("Save"));
|
||||
saveButton.addActionListener(e -> {
|
||||
Language.setLanguage((String) language.getSelectedItem());
|
||||
App.settings.setEnableAnalytics(enableAnalytics.isSelected());
|
||||
App.settings.saveProperties();
|
||||
App.settings.language = (String) language.getSelectedItem();
|
||||
App.settings.enableAnalytics = enableAnalytics.isSelected();
|
||||
App.settings.save();
|
||||
|
||||
if (enableAnalytics.isSelected()) {
|
||||
Analytics.sendEvent("SetupDialogComplete", "Launcher");
|
||||
|
|
|
@ -52,7 +52,7 @@ public final class ViewModsDialog extends JDialog {
|
|||
|
||||
public ViewModsDialog(Pack pack) {
|
||||
// #. {0} is the name of the pack
|
||||
super(App.settings.getParent(), GetText.tr("Mods in {0}", pack.getName()), ModalityType.APPLICATION_MODAL);
|
||||
super(App.launcher.getParent(), GetText.tr("Mods in {0}", pack.getName()), ModalityType.APPLICATION_MODAL);
|
||||
this.pack = pack;
|
||||
|
||||
Analytics.sendScreenView("View Mods Dialog");
|
||||
|
@ -96,7 +96,7 @@ public final class ViewModsDialog extends JDialog {
|
|||
}
|
||||
|
||||
this.pack();
|
||||
this.setLocationRelativeTo(App.settings.getParent());
|
||||
this.setLocationRelativeTo(App.launcher.getParent());
|
||||
}
|
||||
|
||||
private void reload() {
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ModsJCheckBoxTransferHandler extends TransferHandler {
|
|||
|
||||
boolean usesCoreMods = false;
|
||||
try {
|
||||
usesCoreMods = App.settings.getMinecraftVersion(dialog.instanceV2 != null ? dialog.instanceV2.id
|
||||
usesCoreMods = App.launcher.getMinecraftVersion(dialog.instanceV2 != null ? dialog.instanceV2.id
|
||||
: dialog.instance.getMinecraftVersion()).coremods;
|
||||
} catch (InvalidMinecraftVersion e1) {
|
||||
LogManager.logStackTrace(e1);
|
||||
|
|
|
@ -123,7 +123,7 @@ public class AccountsTab extends JPanel implements Tab, RelocalizationListener {
|
|||
|
||||
accountsComboBox = new JComboBox<>();
|
||||
accountsComboBox.addItem(fillerAccount);
|
||||
for (Account account : App.settings.getAccounts()) {
|
||||
for (Account account : App.launcher.getAccounts()) {
|
||||
accountsComboBox.addItem(account);
|
||||
}
|
||||
accountsComboBox.setSelectedIndex(0);
|
||||
|
@ -241,10 +241,10 @@ public class AccountsTab extends JPanel implements Tab, RelocalizationListener {
|
|||
.setType(DialogManager.WARNING).show();
|
||||
if (ret == DialogManager.YES_OPTION) {
|
||||
Analytics.sendEvent("Delete", "Account");
|
||||
App.settings.removeAccount(account);
|
||||
App.launcher.removeAccount(account);
|
||||
accountsComboBox.removeAllItems();
|
||||
accountsComboBox.addItem(fillerAccount);
|
||||
for (Account accountt : App.settings.getAccounts()) {
|
||||
for (Account accountt : App.launcher.getAccounts()) {
|
||||
accountsComboBox.addItem(accountt);
|
||||
}
|
||||
accountsComboBox.setSelectedIndex(0);
|
||||
|
@ -299,7 +299,7 @@ public class AccountsTab extends JPanel implements Tab, RelocalizationListener {
|
|||
String username = usernameField.getText();
|
||||
String password = new String(passwordField.getPassword());
|
||||
boolean remember = rememberField.isSelected();
|
||||
if (App.settings.isAccountByName(username) && accountsComboBox.getSelectedIndex() == 0) {
|
||||
if (App.launcher.isAccountByName(username) && accountsComboBox.getSelectedIndex() == 0) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("Account Not Added"))
|
||||
.setContent(GetText.tr("This account already exists.")).setType(DialogManager.ERROR).show();
|
||||
return;
|
||||
|
@ -321,11 +321,11 @@ public class AccountsTab extends JPanel implements Tab, RelocalizationListener {
|
|||
account = new Account(username, password, response.getAuth().getSelectedProfile().getName(),
|
||||
response.getAuth().getSelectedProfile().getId().toString(), remember, clientToken);
|
||||
account.setStore(response.getAuth().saveForStorage());
|
||||
App.settings.addAccount(account);
|
||||
App.launcher.addAccount(account);
|
||||
Analytics.sendEvent("Add", "Account");
|
||||
LogManager.info("Added Account " + account);
|
||||
|
||||
if (App.settings.getAccounts().size() > 1) {
|
||||
if (App.launcher.getAccounts().size() > 1) {
|
||||
// not first account? ask if they want to switch to it
|
||||
int ret = DialogManager.optionDialog().setTitle(GetText.tr("Account Added"))
|
||||
.setContent(GetText.tr("Account added successfully. Switch to it now?"))
|
||||
|
@ -333,11 +333,11 @@ public class AccountsTab extends JPanel implements Tab, RelocalizationListener {
|
|||
.show();
|
||||
|
||||
if (ret == 0) {
|
||||
App.settings.switchAccount(account);
|
||||
App.launcher.switchAccount(account);
|
||||
}
|
||||
} else {
|
||||
// first account? switch to it immediately
|
||||
App.settings.switchAccount(account);
|
||||
App.launcher.switchAccount(account);
|
||||
}
|
||||
} else {
|
||||
account = (Account) accountsComboBox.getSelectedItem();
|
||||
|
@ -355,11 +355,11 @@ public class AccountsTab extends JPanel implements Tab, RelocalizationListener {
|
|||
DialogManager.okDialog().setTitle(GetText.tr("Account Edited"))
|
||||
.setContent(GetText.tr("Account edited successfully")).setType(DialogManager.INFO).show();
|
||||
}
|
||||
App.settings.saveAccounts();
|
||||
App.settings.reloadAccounts();
|
||||
App.launcher.saveAccounts();
|
||||
App.launcher.reloadAccounts();
|
||||
accountsComboBox.removeAllItems();
|
||||
accountsComboBox.addItem(fillerAccount);
|
||||
for (Account accountt : App.settings.getAccounts()) {
|
||||
for (Account accountt : App.launcher.getAccounts()) {
|
||||
accountsComboBox.addItem(accountt);
|
||||
}
|
||||
accountsComboBox.setSelectedItem(account);
|
||||
|
|
|
@ -133,7 +133,7 @@ public class InstancesTab extends JPanel implements Tab, RelocalizationListener
|
|||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
|
||||
App.settings.getInstancesSorted().stream().filter(Instance::canPlay).forEach(instance -> {
|
||||
App.launcher.getInstancesSorted().stream().filter(Instance::canPlay).forEach(instance -> {
|
||||
if (keepFilters) {
|
||||
boolean showInstance = true;
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class InstancesTab extends JPanel implements Tab, RelocalizationListener
|
|||
}
|
||||
});
|
||||
|
||||
App.settings.getInstancesV2Sorted().stream().forEach(instance -> {
|
||||
App.launcher.getInstancesV2Sorted().stream().forEach(instance -> {
|
||||
if (keepFilters) {
|
||||
boolean showInstance = true;
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public class NewsTab extends JPanel implements Tab {
|
|||
*/
|
||||
public void reload() {
|
||||
this.NEWS_PANE.setText("");
|
||||
this.NEWS_PANE.setText(App.settings.getNewsHTML());
|
||||
this.NEWS_PANE.setText(App.launcher.getNewsHTML());
|
||||
this.NEWS_PANE.setCaretPosition(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,9 +162,9 @@ public final class PacksTab extends JPanel implements Tab, RelocalizationListene
|
|||
return;
|
||||
}
|
||||
|
||||
List<Pack> packs = App.settings.sortPacksAlphabetically()
|
||||
? App.settings.getPacksSortedAlphabetically(this.isFeatured, this.isSystem)
|
||||
: App.settings.getPacksSortedPositionally(this.isFeatured, this.isSystem);
|
||||
List<Pack> packs = App.settings.sortPacksAlphabetically
|
||||
? App.launcher.getPacksSortedAlphabetically(this.isFeatured, this.isSystem)
|
||||
: App.launcher.getPacksSortedPositionally(this.isFeatured, this.isSystem);
|
||||
|
||||
for (Pack pack : packs) {
|
||||
if (pack.canInstall()) {
|
||||
|
|
|
@ -40,7 +40,7 @@ import com.atlauncher.gui.dialogs.AddEditServerForCheckerDialog;
|
|||
|
||||
import org.mini2Dx.gettext.GetText;
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class ServersForCheckerTab extends JPanel implements ActionListener {
|
||||
private static final long serialVersionUID = 3385411077046354453L;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class ServersForCheckerTab extends JPanel implements ActionListener {
|
|||
CONTEXT_MENU.add(DELETE_BUTTON);
|
||||
|
||||
listModel = new DefaultListModel<>();
|
||||
for (MinecraftServer server : App.settings.getCheckingServers()) {
|
||||
for (MinecraftServer server : App.launcher.getCheckingServers()) {
|
||||
listModel.addElement(server);
|
||||
}
|
||||
serverList = new JList(listModel);
|
||||
|
@ -121,7 +121,7 @@ public class ServersForCheckerTab extends JPanel implements ActionListener {
|
|||
public void deleteSelectedElement() {
|
||||
if (serverList.getSelectedIndex() != -1) {
|
||||
MinecraftServer selectedValue = ((MinecraftServer) serverList.getSelectedValue());
|
||||
App.settings.removeCheckingServer(selectedValue);
|
||||
App.launcher.removeCheckingServer(selectedValue);
|
||||
listModel.removeElement(selectedValue);
|
||||
reloadServers();
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class ServersForCheckerTab extends JPanel implements ActionListener {
|
|||
|
||||
public void reloadServers() {
|
||||
listModel.removeAllElements();
|
||||
for (MinecraftServer server : App.settings.getCheckingServers()) {
|
||||
for (MinecraftServer server : App.launcher.getCheckingServers()) {
|
||||
listModel.addElement(server);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ public class ServersTab extends JPanel implements Tab, RelocalizationListener {
|
|||
gbc.insets = UIConstants.FIELD_INSETS_SMALL;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
|
||||
App.settings.getServersSorted().stream().forEach(server -> {
|
||||
App.launcher.getServersSorted().stream().forEach(server -> {
|
||||
if (keepFilters) {
|
||||
boolean showServer = true;
|
||||
|
||||
|
|
|
@ -89,16 +89,16 @@ public class SettingsTab extends JPanel implements Tab, RelocalizationListener {
|
|||
loggingSettingsTab.save();
|
||||
toolsSettingsTab.save();
|
||||
backupsSettingsTab.save();
|
||||
App.settings.saveProperties();
|
||||
App.settings.save();
|
||||
SettingsManager.post();
|
||||
if (reloadPacksPanel) {
|
||||
App.settings.reloadPacksPanel();
|
||||
App.launcher.reloadPacksPanel();
|
||||
}
|
||||
if (restartServerChecker) {
|
||||
App.settings.startCheckingServers();
|
||||
App.launcher.startCheckingServers();
|
||||
}
|
||||
if (reloadTheme) {
|
||||
App.loadTheme(App.settings.getTheme());
|
||||
App.loadTheme(App.settings.theme);
|
||||
Analytics.sendEvent(App.THEME.getName(), "ChangeTheme", "Launcher");
|
||||
FlatLaf.updateUILater();
|
||||
ThemeManager.post();
|
||||
|
|
|
@ -46,12 +46,12 @@ public class BackupsSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
enableModsBackups = new JCheckBox();
|
||||
enableModsBackups.setSelected(App.settings.enableModsBackups());
|
||||
enableModsBackups.setSelected(App.settings.enableModsBackups);
|
||||
add(enableModsBackups, gbc);
|
||||
}
|
||||
|
||||
public void save() {
|
||||
App.settings.setEnableModsBackups(enableModsBackups.isSelected());
|
||||
App.settings.enableModsBackups = enableModsBackups.isSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -126,7 +126,7 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
for (int i = 0; i < theme.getItemCount(); i++) {
|
||||
ComboItem item = theme.getItemAt(i);
|
||||
|
||||
if (item.getValue().equalsIgnoreCase(App.settings.getTheme())) {
|
||||
if (item.getValue().equalsIgnoreCase(App.settings.theme)) {
|
||||
theme.setSelectedIndex(i);
|
||||
break;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
dateFormat.addItem(new ComboItem(format, new SimpleDateFormat(format).format(new Date())));
|
||||
}
|
||||
|
||||
dateFormat.setSelectedItem(App.settings.getDateFormat());
|
||||
dateFormat.setSelectedItem(App.settings.dateFormat);
|
||||
|
||||
add(dateFormat, gbc);
|
||||
|
||||
|
@ -173,7 +173,7 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
sortPacksAlphabetically = new JCheckBox();
|
||||
if (App.settings.sortPacksAlphabetically()) {
|
||||
if (App.settings.sortPacksAlphabetically) {
|
||||
sortPacksAlphabetically.setSelected(true);
|
||||
}
|
||||
add(sortPacksAlphabetically, gbc);
|
||||
|
@ -192,7 +192,7 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
keepLauncherOpen = new JCheckBox();
|
||||
if (App.settings.keepLauncherOpen()) {
|
||||
if (App.settings.keepLauncherOpen) {
|
||||
keepLauncherOpen.setSelected(true);
|
||||
}
|
||||
add(keepLauncherOpen, gbc);
|
||||
|
@ -211,7 +211,7 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
enableConsole = new JCheckBox();
|
||||
if (App.settings.enableConsole()) {
|
||||
if (App.settings.enableConsole) {
|
||||
enableConsole.setSelected(true);
|
||||
}
|
||||
add(enableConsole, gbc);
|
||||
|
@ -232,7 +232,7 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
enableTrayIcon = new JCheckBox();
|
||||
if (App.settings.enableTrayIcon()) {
|
||||
if (App.settings.enableTrayMenu) {
|
||||
enableTrayIcon.setSelected(true);
|
||||
}
|
||||
add(enableTrayIcon, gbc);
|
||||
|
@ -251,7 +251,7 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
enableDiscordIntegration = new JCheckBox();
|
||||
if (App.settings.enableDiscordIntegration()) {
|
||||
if (App.settings.enableDiscordIntegration) {
|
||||
enableDiscordIntegration.setSelected(true);
|
||||
}
|
||||
add(enableDiscordIntegration, gbc);
|
||||
|
@ -273,7 +273,7 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
enableFeralGamemode = new JCheckBox();
|
||||
if (App.settings.enableFeralGamemode()) {
|
||||
if (App.settings.enableFeralGamemode) {
|
||||
enableFeralGamemode.setSelected(true);
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
enablePackTags = new JCheckBox();
|
||||
enablePackTags.setSelected(App.settings.enabledPackTags());
|
||||
enablePackTags.setSelected(App.settings.enablePackTags);
|
||||
add(enablePackTags, gbc);
|
||||
|
||||
// Disable Curse Minecraft version restrictions
|
||||
|
@ -321,16 +321,16 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
disableAddModRestrictions = new JCheckBox();
|
||||
disableAddModRestrictions.setSelected(App.settings.disabledAddModRestrictions());
|
||||
disableAddModRestrictions.setSelected(App.settings.disableAddModRestrictions);
|
||||
add(disableAddModRestrictions, gbc);
|
||||
}
|
||||
|
||||
public boolean needToReloadTheme() {
|
||||
return !((ComboItem) theme.getSelectedItem()).getValue().equalsIgnoreCase(App.settings.getTheme());
|
||||
return !((ComboItem) theme.getSelectedItem()).getValue().equalsIgnoreCase(App.settings.theme);
|
||||
}
|
||||
|
||||
public boolean needToReloadPacksPanel() {
|
||||
return sortPacksAlphabetically.isSelected() != App.settings.sortPacksAlphabetically();
|
||||
return sortPacksAlphabetically.isSelected() != App.settings.sortPacksAlphabetically;
|
||||
}
|
||||
|
||||
public boolean needToReloadLanguage() {
|
||||
|
@ -339,22 +339,23 @@ public class GeneralSettingsTab extends AbstractSettingsTab {
|
|||
|
||||
public void save() {
|
||||
Language.setLanguage((String) language.getSelectedItem());
|
||||
App.settings.setTheme(((ComboItem) theme.getSelectedItem()).getValue());
|
||||
App.settings.setDateFormat(((ComboItem) dateFormat.getSelectedItem()).getValue());
|
||||
App.settings.setSortPacksAlphabetically(sortPacksAlphabetically.isSelected());
|
||||
App.settings.setKeepLauncherOpen(keepLauncherOpen.isSelected());
|
||||
App.settings.setEnableConsole(enableConsole.isSelected());
|
||||
App.settings.setEnableTrayIcon(enableTrayIcon.isSelected());
|
||||
App.settings.setEnableDiscordIntegration(enableDiscordIntegration.isSelected());
|
||||
App.settings.language = (String) language.getSelectedItem();
|
||||
App.settings.theme = ((ComboItem) theme.getSelectedItem()).getValue();
|
||||
App.settings.dateFormat = ((ComboItem) dateFormat.getSelectedItem()).getValue();
|
||||
App.settings.sortPacksAlphabetically = sortPacksAlphabetically.isSelected();
|
||||
App.settings.keepLauncherOpen = keepLauncherOpen.isSelected();
|
||||
App.settings.enableConsole = enableConsole.isSelected();
|
||||
App.settings.enableTrayMenu = enableTrayIcon.isSelected();
|
||||
App.settings.enableDiscordIntegration = enableDiscordIntegration.isSelected();
|
||||
|
||||
if (OS.isLinux()) {
|
||||
App.settings.setEnableFeralGameMode(enableFeralGamemode.isSelected());
|
||||
App.settings.enableFeralGamemode = enableFeralGamemode.isSelected();
|
||||
} else {
|
||||
App.settings.setEnableFeralGameMode(false);
|
||||
App.settings.enableFeralGamemode = false;
|
||||
}
|
||||
|
||||
App.settings.setPackTags(enablePackTags.isSelected());
|
||||
App.settings.setAddModRestrictions(disableAddModRestrictions.isSelected());
|
||||
App.settings.enablePackTags = enablePackTags.isSelected();
|
||||
App.settings.disableAddModRestrictions = disableAddModRestrictions.isSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -119,8 +119,7 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
gbc.gridx++;
|
||||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel initialMemoryModel = new SpinnerNumberModel(App.settings.getInitialMemory(), null, null,
|
||||
128);
|
||||
SpinnerNumberModel initialMemoryModel = new SpinnerNumberModel(App.settings.initialMemory, null, null, 128);
|
||||
initialMemoryModel.setMinimum(128);
|
||||
initialMemoryModel.setMaximum((systemRam == 0 ? null : systemRam));
|
||||
initialMemory = new JSpinner(initialMemoryModel);
|
||||
|
@ -153,8 +152,7 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
gbc.gridx++;
|
||||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel maximumMemoryModel = new SpinnerNumberModel(App.settings.getMaximumMemory(), null, null,
|
||||
512);
|
||||
SpinnerNumberModel maximumMemoryModel = new SpinnerNumberModel(App.settings.maximumMemory, null, null, 512);
|
||||
maximumMemoryModel.setMinimum(512);
|
||||
maximumMemoryModel.setMaximum((systemRam == 0 ? null : systemRam));
|
||||
maximumMemory = new JSpinner(maximumMemoryModel);
|
||||
|
@ -173,7 +171,7 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
gbc.gridx++;
|
||||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel permGenModel = new SpinnerNumberModel(App.settings.getPermGen(), null, null, 32);
|
||||
SpinnerNumberModel permGenModel = new SpinnerNumberModel(App.settings.metaspace, null, null, 32);
|
||||
permGenModel.setMinimum(32);
|
||||
permGenModel.setMaximum((systemRam == 0 ? null : systemRam));
|
||||
permGen = new JSpinner(permGenModel);
|
||||
|
@ -197,12 +195,12 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
windowSizePanel = new JPanel();
|
||||
windowSizePanel.setLayout(new BoxLayout(windowSizePanel, BoxLayout.X_AXIS));
|
||||
|
||||
SpinnerNumberModel widthModel = new SpinnerNumberModel(App.settings.getWindowWidth(), 1,
|
||||
OS.getMaximumWindowWidth(), 1);
|
||||
SpinnerNumberModel widthModel = new SpinnerNumberModel(App.settings.windowWidth, 1, OS.getMaximumWindowWidth(),
|
||||
1);
|
||||
widthField = new JSpinner(widthModel);
|
||||
widthField.setEditor(new JSpinner.NumberEditor(widthField, "#"));
|
||||
|
||||
SpinnerNumberModel heightModel = new SpinnerNumberModel(App.settings.getWindowHeight(), 1,
|
||||
SpinnerNumberModel heightModel = new SpinnerNumberModel(App.settings.windowHeight, 1,
|
||||
OS.getMaximumWindowHeight(), 1);
|
||||
heightField = new JSpinner(heightModel);
|
||||
heightField.setEditor(new JSpinner.NumberEditor(heightField, "#"));
|
||||
|
@ -272,7 +270,7 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
Java.getInstalledJavas().stream().forEach(installedJavas::addItem);
|
||||
|
||||
installedJavas.setSelectedItem(Java.getInstalledJavas().stream()
|
||||
.filter(javaInfo -> javaInfo.rootPath.equalsIgnoreCase(App.settings.getJavaPath())).findFirst()
|
||||
.filter(javaInfo -> javaInfo.rootPath.equalsIgnoreCase(App.settings.javaPath)).findFirst()
|
||||
.orElse(null));
|
||||
|
||||
installedJavas
|
||||
|
@ -284,7 +282,7 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
}
|
||||
|
||||
javaPath = new JTextField(32);
|
||||
javaPath.setText(App.settings.getJavaPath());
|
||||
javaPath.setText(App.settings.javaPath);
|
||||
javaPathResetButton = new JButton(GetText.tr("Reset"));
|
||||
javaPathResetButton.addActionListener(e -> javaPath.setText(OS.getDefaultJavaPath()));
|
||||
javaBrowseButton = new JButton(GetText.tr("Browse"));
|
||||
|
@ -332,7 +330,7 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
javaParametersPanel.setAlignmentY(Component.TOP_ALIGNMENT);
|
||||
|
||||
javaParameters = new JTextArea(6, 40);
|
||||
javaParameters.setText(App.settings.getJavaParameters());
|
||||
javaParameters.setText(App.settings.javaParameters);
|
||||
javaParameters.setLineWrap(true);
|
||||
javaParameters.setWrapStyleWord(true);
|
||||
|
||||
|
@ -364,7 +362,7 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
startMinecraftMaximised = new JCheckBox();
|
||||
if (App.settings.startMinecraftMaximised()) {
|
||||
if (App.settings.maximiseMinecraft) {
|
||||
startMinecraftMaximised.setSelected(true);
|
||||
}
|
||||
add(startMinecraftMaximised, gbc);
|
||||
|
@ -384,7 +382,7 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
ignoreJavaOnInstanceLaunch = new JCheckBox();
|
||||
if (App.settings.ignoreJavaOnInstanceLaunch()) {
|
||||
if (App.settings.ignoreJavaOnInstanceLaunch) {
|
||||
ignoreJavaOnInstanceLaunch.setSelected(true);
|
||||
}
|
||||
add(ignoreJavaOnInstanceLaunch, gbc);
|
||||
|
@ -414,15 +412,15 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
}
|
||||
|
||||
public void save() {
|
||||
App.settings.setInitialMemory((Integer) initialMemory.getValue());
|
||||
App.settings.setMaximumMemory((Integer) maximumMemory.getValue());
|
||||
App.settings.setPermGen((Integer) permGen.getValue());
|
||||
App.settings.setWindowWidth((Integer) widthField.getValue());
|
||||
App.settings.setWindowHeight((Integer) heightField.getValue());
|
||||
App.settings.setJavaPath(javaPath.getText());
|
||||
App.settings.setJavaParameters(javaParameters.getText());
|
||||
App.settings.setStartMinecraftMaximised(startMinecraftMaximised.isSelected());
|
||||
App.settings.setIgnoreJavaOnInstanceLaunch(ignoreJavaOnInstanceLaunch.isSelected());
|
||||
App.settings.initialMemory = (Integer) initialMemory.getValue();
|
||||
App.settings.maximumMemory = (Integer) maximumMemory.getValue();
|
||||
App.settings.metaspace = (Integer) permGen.getValue();
|
||||
App.settings.windowWidth = (Integer) widthField.getValue();
|
||||
App.settings.windowHeight = (Integer) heightField.getValue();
|
||||
App.settings.javaPath = javaPath.getText();
|
||||
App.settings.javaParameters = javaParameters.getText();
|
||||
App.settings.maximiseMinecraft = startMinecraftMaximised.isSelected();
|
||||
App.settings.ignoreJavaOnInstanceLaunch = ignoreJavaOnInstanceLaunch.isSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -478,6 +476,6 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
|
||||
@Override
|
||||
public void onSettingsSaved() {
|
||||
javaPath.setText(App.settings.getJavaPath());
|
||||
javaPath.setText(App.settings.javaPath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class LoggingSettingsTab extends AbstractSettingsTab {
|
|||
forgeLoggingLevel.addItem("FINE");
|
||||
forgeLoggingLevel.addItem("FINER");
|
||||
forgeLoggingLevel.addItem("FINEST");
|
||||
forgeLoggingLevel.setSelectedItem(App.settings.getForgeLoggingLevel());
|
||||
forgeLoggingLevel.setSelectedItem(App.settings.forgeLoggingLevel);
|
||||
add(forgeLoggingLevel, gbc);
|
||||
|
||||
// Enable Logging
|
||||
|
@ -92,7 +92,7 @@ public class LoggingSettingsTab extends AbstractSettingsTab {
|
|||
enableOpenEyeReporting.setEnabled(true);
|
||||
}
|
||||
});
|
||||
if (App.settings.enableLogs()) {
|
||||
if (App.settings.enableLogs) {
|
||||
enableLogs.setSelected(true);
|
||||
}
|
||||
add(enableLogs, gbc);
|
||||
|
@ -113,7 +113,7 @@ public class LoggingSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
enableAnalytics = new JCheckBox();
|
||||
if (App.settings.enableAnalytics()) {
|
||||
if (App.settings.enableAnalytics) {
|
||||
enableAnalytics.setSelected(true);
|
||||
}
|
||||
add(enableAnalytics, gbc);
|
||||
|
@ -134,20 +134,20 @@ public class LoggingSettingsTab extends AbstractSettingsTab {
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
enableOpenEyeReporting = new JCheckBox();
|
||||
if (!App.settings.enableLogs()) {
|
||||
if (!App.settings.enableLogs) {
|
||||
enableOpenEyeReporting.setEnabled(false);
|
||||
}
|
||||
if (App.settings.enableOpenEyeReporting()) {
|
||||
if (App.settings.enableOpenEyeReporting) {
|
||||
enableOpenEyeReporting.setSelected(true);
|
||||
}
|
||||
add(enableOpenEyeReporting, gbc);
|
||||
}
|
||||
|
||||
public void save() {
|
||||
App.settings.setForgeLoggingLevel((String) forgeLoggingLevel.getSelectedItem());
|
||||
App.settings.setEnableLogs(enableLogs.isSelected());
|
||||
App.settings.setEnableAnalytics(enableAnalytics.isSelected());
|
||||
App.settings.setEnableOpenEyeReporting(enableOpenEyeReporting.isSelected());
|
||||
App.settings.forgeLoggingLevel = (String) forgeLoggingLevel.getSelectedItem();
|
||||
App.settings.enableLogs = enableLogs.isSelected();
|
||||
App.settings.enableAnalytics = enableAnalytics.isSelected();
|
||||
App.settings.enableOpenEyeReporting = enableOpenEyeReporting.isSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,8 +70,8 @@ public class NetworkSettingsTab extends AbstractSettingsTab implements Relocaliz
|
|||
gbc.gridx++;
|
||||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel concurrentConnectionsModel = new SpinnerNumberModel(App.settings.getConcurrentConnections(),
|
||||
null, null, 1);
|
||||
SpinnerNumberModel concurrentConnectionsModel = new SpinnerNumberModel(App.settings.concurrentConnections, null,
|
||||
null, 1);
|
||||
concurrentConnectionsModel.setMinimum(1);
|
||||
concurrentConnections = new JSpinner(concurrentConnectionsModel);
|
||||
add(concurrentConnections, gbc);
|
||||
|
@ -90,7 +90,7 @@ public class NetworkSettingsTab extends AbstractSettingsTab implements Relocaliz
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
enableProxy = new JCheckBox();
|
||||
if (App.settings.getEnableProxy()) {
|
||||
if (App.settings.enableProxy) {
|
||||
enableProxy.setSelected(true);
|
||||
}
|
||||
enableProxy.addActionListener(e -> {
|
||||
|
@ -119,7 +119,7 @@ public class NetworkSettingsTab extends AbstractSettingsTab implements Relocaliz
|
|||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
proxyHost = new JTextField(20);
|
||||
proxyHost.setText(App.settings.getProxyHost());
|
||||
proxyHost.setText(App.settings.proxyHost);
|
||||
if (!enableProxy.isSelected()) {
|
||||
proxyHost.setEnabled(false);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class NetworkSettingsTab extends AbstractSettingsTab implements Relocaliz
|
|||
gbc.gridx++;
|
||||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel proxyPortModel = new SpinnerNumberModel(App.settings.getProxyPort(), null, null, 1);
|
||||
SpinnerNumberModel proxyPortModel = new SpinnerNumberModel(App.settings.proxyPort, null, null, 1);
|
||||
proxyPortModel.setMinimum(1);
|
||||
proxyPortModel.setMaximum(65535);
|
||||
proxyPort = new JSpinner(proxyPortModel);
|
||||
|
@ -163,7 +163,7 @@ public class NetworkSettingsTab extends AbstractSettingsTab implements Relocaliz
|
|||
proxyType.addItem("HTTP");
|
||||
proxyType.addItem("SOCKS");
|
||||
proxyType.addItem("DIRECT");
|
||||
proxyType.setSelectedItem(App.settings.getProxyType());
|
||||
proxyType.setSelectedItem(App.settings.proxyType);
|
||||
if (!enableProxy.isSelected()) {
|
||||
proxyType.setEnabled(false);
|
||||
}
|
||||
|
@ -214,12 +214,12 @@ public class NetworkSettingsTab extends AbstractSettingsTab implements Relocaliz
|
|||
}
|
||||
|
||||
public void save() {
|
||||
App.settings.setConcurrentConnections((Integer) concurrentConnections.getValue());
|
||||
App.settings.setEnableProxy(enableProxy.isSelected());
|
||||
App.settings.concurrentConnections = (Integer) concurrentConnections.getValue();
|
||||
App.settings.enableProxy = enableProxy.isSelected();
|
||||
if (enableProxy.isSelected()) {
|
||||
App.settings.setProxyHost(proxyHost.getText());
|
||||
App.settings.setProxyPort((Integer) proxyPort.getValue());
|
||||
App.settings.setProxyType(((String) proxyType.getSelectedItem()));
|
||||
App.settings.proxyHost = proxyHost.getText();
|
||||
App.settings.proxyPort = (Integer) proxyPort.getValue();
|
||||
App.settings.proxyType = ((String) proxyType.getSelectedItem());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ToolsSettingsTab extends AbstractSettingsTab implements Relocalizat
|
|||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
enableServerChecker = new JCheckBox();
|
||||
if (App.settings.enableServerChecker()) {
|
||||
if (App.settings.enableServerChecker) {
|
||||
enableServerChecker.setSelected(true);
|
||||
}
|
||||
enableServerChecker.addActionListener(e -> {
|
||||
|
@ -82,24 +82,23 @@ public class ToolsSettingsTab extends AbstractSettingsTab implements Relocalizat
|
|||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
|
||||
SpinnerNumberModel serverCheckerWaitModel = new SpinnerNumberModel(App.settings.getServerCheckerWait(), 1, 30,
|
||||
1);
|
||||
SpinnerNumberModel serverCheckerWaitModel = new SpinnerNumberModel(App.settings.serverCheckerWait, 1, 30, 1);
|
||||
|
||||
serverCheckerWait = new JSpinner(serverCheckerWaitModel);
|
||||
if (!App.settings.enableServerChecker()) {
|
||||
if (!App.settings.enableServerChecker) {
|
||||
serverCheckerWait.setEnabled(false);
|
||||
}
|
||||
add(serverCheckerWait, gbc);
|
||||
}
|
||||
|
||||
public boolean needToRestartServerChecker() {
|
||||
return ((enableServerChecker.isSelected() != App.settings.enableServerChecker())
|
||||
|| (App.settings.getServerCheckerWait() != (Integer) serverCheckerWait.getValue()));
|
||||
return ((enableServerChecker.isSelected() != App.settings.enableServerChecker)
|
||||
|| (App.settings.serverCheckerWait != (Integer) serverCheckerWait.getValue()));
|
||||
}
|
||||
|
||||
public void save() {
|
||||
App.settings.setEnableServerChecker(enableServerChecker.isSelected());
|
||||
App.settings.setServerCheckerWait((Integer) serverCheckerWait.getValue());
|
||||
App.settings.enableServerChecker = enableServerChecker.isSelected();
|
||||
App.settings.serverCheckerWait = (Integer) serverCheckerWait.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -57,7 +57,7 @@ public class NetworkCheckerToolPanel extends AbstractToolPanel implements Action
|
|||
}
|
||||
|
||||
private void checkLaunchButtonEnabled() {
|
||||
LAUNCH_BUTTON.setEnabled(App.settings.enableLogs());
|
||||
LAUNCH_BUTTON.setEnabled(App.settings.enableLogs);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -151,8 +151,8 @@ public class RuntimeDownloaderToolPanel extends AbstractToolPanel implements Act
|
|||
|
||||
String path = (String) dialog.getReturnValue();
|
||||
|
||||
App.settings.setJavaPath(path);
|
||||
App.settings.saveProperties();
|
||||
App.settings.javaPath = path;
|
||||
App.settings.save();
|
||||
|
||||
DialogManager.okDialog().setTitle(GetText.tr("Runtime Downloader"))
|
||||
.setContent(new HTMLBuilder().center()
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ServerCheckerToolPanel extends AbstractToolPanel implements ActionL
|
|||
}
|
||||
|
||||
private void checkLaunchButtonEnabled() {
|
||||
LAUNCH_BUTTON.setEnabled(App.settings.enableServerChecker());
|
||||
LAUNCH_BUTTON.setEnabled(App.settings.enableServerChecker);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -160,8 +160,8 @@ public final class DialogManager {
|
|||
return this.parent;
|
||||
}
|
||||
|
||||
if (App.settings != null && App.settings.getParent() != null) {
|
||||
return App.settings.getParent();
|
||||
if (App.settings != null && App.launcher.getParent() != null) {
|
||||
return App.launcher.getParent();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -58,13 +58,13 @@ public class MCLauncher {
|
|||
1);
|
||||
|
||||
InstanceSettings settings = instance.getSettings();
|
||||
Integer initialMemory = settings.getInitialMemory() == null ? App.settings.getInitialMemory()
|
||||
Integer initialMemory = settings.getInitialMemory() == null ? App.settings.initialMemory
|
||||
: settings.getInitialMemory();
|
||||
Integer maximumMemory = settings.getMaximumMemory() == null ? App.settings.getMaximumMemory()
|
||||
Integer maximumMemory = settings.getMaximumMemory() == null ? App.settings.maximumMemory
|
||||
: settings.getMaximumMemory();
|
||||
Integer permGen = settings.getPermGen() == null ? App.settings.getPermGen() : settings.getPermGen();
|
||||
String javaPath = settings.getJavaPath() == null ? App.settings.getJavaPath() : settings.getJavaPath();
|
||||
String javaArguments = settings.getJavaArguments() == null ? App.settings.getJavaParameters()
|
||||
Integer permGen = settings.getPermGen() == null ? App.settings.metaspace : settings.getPermGen();
|
||||
String javaPath = settings.getJavaPath() == null ? App.settings.javaPath : settings.getJavaPath();
|
||||
String javaArguments = settings.getJavaArguments() == null ? App.settings.javaParameters
|
||||
: settings.getJavaArguments();
|
||||
|
||||
File jarMods = instance.getJarModsDirectory();
|
||||
|
@ -157,7 +157,7 @@ public class MCLauncher {
|
|||
System.out.println("Okay you can look again, you saw NOTHING!");
|
||||
}
|
||||
|
||||
arguments.add("-Dfml.log.level=" + App.settings.getForgeLoggingLevel());
|
||||
arguments.add("-Dfml.log.level=" + App.settings.forgeLoggingLevel);
|
||||
|
||||
if (OS.isMac()) {
|
||||
arguments.add("-Dapple.laf.useScreenMenuBar=true");
|
||||
|
@ -273,12 +273,12 @@ public class MCLauncher {
|
|||
arguments.add("--assetsDir=" + FileSystem.ASSETS.toAbsolutePath().toString());
|
||||
}
|
||||
|
||||
if (App.settings.startMinecraftMaximised()) {
|
||||
if (App.settings.maximiseMinecraft) {
|
||||
arguments.add("--width=" + OS.getMaximumWindowWidth());
|
||||
arguments.add("--height=" + OS.getMaximumWindowHeight());
|
||||
} else {
|
||||
arguments.add("--width=" + App.settings.getWindowWidth());
|
||||
arguments.add("--height=" + App.settings.getWindowHeight());
|
||||
arguments.add("--width=" + App.settings.windowWidth);
|
||||
arguments.add("--height=" + App.settings.windowHeight);
|
||||
}
|
||||
|
||||
if (instance.hasExtraArguments()) {
|
||||
|
@ -327,13 +327,13 @@ public class MCLauncher {
|
|||
ErrorReporting.recordInstancePlay(instance.launcher.pack, instance.launcher.version,
|
||||
instance.launcher.loaderVersion, 2);
|
||||
|
||||
Integer initialMemory = instance.launcher.initialMemory == null ? App.settings.getInitialMemory()
|
||||
Integer initialMemory = instance.launcher.initialMemory == null ? App.settings.initialMemory
|
||||
: instance.launcher.initialMemory;
|
||||
Integer maximumMemory = instance.launcher.maximumMemory == null ? App.settings.getMaximumMemory()
|
||||
Integer maximumMemory = instance.launcher.maximumMemory == null ? App.settings.maximumMemory
|
||||
: instance.launcher.maximumMemory;
|
||||
Integer permGen = instance.launcher.permGen == null ? App.settings.getPermGen() : instance.launcher.permGen;
|
||||
String javaPath = instance.launcher.javaPath == null ? App.settings.getJavaPath() : instance.launcher.javaPath;
|
||||
String javaArguments = instance.launcher.javaArguments == null ? App.settings.getJavaParameters()
|
||||
Integer permGen = instance.launcher.permGen == null ? App.settings.metaspace : instance.launcher.permGen;
|
||||
String javaPath = instance.launcher.javaPath == null ? App.settings.javaPath : instance.launcher.javaPath;
|
||||
String javaArguments = instance.launcher.javaArguments == null ? App.settings.javaParameters
|
||||
: instance.launcher.javaArguments;
|
||||
|
||||
// add minecraft client jar
|
||||
|
@ -378,7 +378,7 @@ public class MCLauncher {
|
|||
|
||||
List<String> arguments = new ArrayList<>();
|
||||
|
||||
if (OS.isLinux() && App.settings.enableFeralGamemode() && Utils.executableInPath("gamemoderun")) {
|
||||
if (OS.isLinux() && App.settings.enableFeralGamemode && Utils.executableInPath("gamemoderun")) {
|
||||
arguments.add("gamemoderun");
|
||||
}
|
||||
|
||||
|
@ -431,7 +431,7 @@ public class MCLauncher {
|
|||
System.out.println("Okay you can look again, you saw NOTHING!");
|
||||
}
|
||||
|
||||
arguments.add("-Dfml.log.level=" + App.settings.getForgeLoggingLevel());
|
||||
arguments.add("-Dfml.log.level=" + App.settings.forgeLoggingLevel);
|
||||
|
||||
if (OS.isMac()) {
|
||||
arguments.add("-Dapple.laf.useScreenMenuBar=true");
|
||||
|
@ -515,12 +515,12 @@ public class MCLauncher {
|
|||
}
|
||||
}
|
||||
|
||||
if (App.settings.startMinecraftMaximised()) {
|
||||
if (App.settings.maximiseMinecraft) {
|
||||
arguments.add("--width=" + OS.getMaximumWindowWidth());
|
||||
arguments.add("--height=" + OS.getMaximumWindowHeight());
|
||||
} else {
|
||||
arguments.add("--width=" + App.settings.getWindowWidth());
|
||||
arguments.add("--height=" + App.settings.getWindowHeight());
|
||||
arguments.add("--width=" + App.settings.windowWidth);
|
||||
arguments.add("--height=" + App.settings.windowHeight);
|
||||
}
|
||||
|
||||
String argsString = arguments.toString();
|
||||
|
|
|
@ -33,11 +33,10 @@ public final class Analytics implements SettingsListener {
|
|||
public static void startSession() {
|
||||
ga = GoogleAnalytics.builder()
|
||||
.withConfig(new GoogleAnalyticsConfig().setDiscoverRequestParameters(true)
|
||||
.setProxyHost(App.settings.getProxyHost()).setProxyPort(App.settings.getProxyPort())
|
||||
.setEnabled(App.settings.enableAnalytics()))
|
||||
.withDefaultRequest(
|
||||
new DefaultRequest().userAgent(Network.USER_AGENT).clientId(App.settings.getAnalyticsClientId())
|
||||
.customDimension(1, Java.getLauncherJavaVersion()))
|
||||
.setProxyHost(App.settings.proxyHost).setProxyPort(App.settings.proxyPort)
|
||||
.setEnabled(App.settings.enableAnalytics))
|
||||
.withDefaultRequest(new DefaultRequest().userAgent(Network.USER_AGENT)
|
||||
.clientId(App.settings.analyticsClientId).customDimension(1, Java.getLauncherJavaVersion()))
|
||||
.withTrackingId(Constants.GA_TRACKING_ID).withAppName(Constants.LAUNCHER_NAME)
|
||||
.withAppVersion(Constants.VERSION.toString()).build();
|
||||
|
||||
|
@ -101,7 +100,7 @@ public final class Analytics implements SettingsListener {
|
|||
|
||||
@Override
|
||||
public void onSettingsSaved() {
|
||||
ga.getConfig().setProxyHost(App.settings.getProxyHost()).setProxyPort(App.settings.getProxyPort())
|
||||
.setEnabled(App.settings.enableAnalytics());
|
||||
ga.getConfig().setProxyHost(App.settings.proxyHost).setProxyPort(App.settings.proxyPort)
|
||||
.setEnabled(App.settings.enableAnalytics);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public final class DownloadPool extends LinkedList<Download> {
|
|||
}
|
||||
|
||||
public void downloadAll() {
|
||||
ExecutorService executor = Executors.newFixedThreadPool(App.settings.getConcurrentConnections());
|
||||
ExecutorService executor = Executors.newFixedThreadPool(App.settings.concurrentConnections);
|
||||
synchronized (this) {
|
||||
for (Download dl : this) {
|
||||
executor.execute(new Downloader(dl));
|
||||
|
@ -68,7 +68,7 @@ public final class DownloadPool extends LinkedList<Download> {
|
|||
final DownloadPool pool = new DownloadPool(this.wait);
|
||||
final List<Download> downloads = this.stream().distinct().collect(Collectors.toList());
|
||||
|
||||
ExecutorService executor = Executors.newFixedThreadPool(App.settings.getConcurrentConnections());
|
||||
ExecutorService executor = Executors.newFixedThreadPool(App.settings.concurrentConnections);
|
||||
for (final Download dl : downloads) {
|
||||
executor.submit(() -> {
|
||||
if (dl.needToDownload()) {
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
|
|||
public class Authentication {
|
||||
public static LoginResponse checkAccount(String username, String password, String clientToken) {
|
||||
YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) new YggdrasilAuthenticationService(
|
||||
App.settings.getProxyForAuth(), clientToken).createUserAuthentication(Agent.MINECRAFT);
|
||||
App.settings.proxy, clientToken).createUserAuthentication(Agent.MINECRAFT);
|
||||
|
||||
LoginResponse response = new LoginResponse(username);
|
||||
|
||||
|
@ -52,8 +52,8 @@ public class Authentication {
|
|||
}
|
||||
|
||||
public static LoginResponse login(Account account, boolean usePassword) {
|
||||
UserAuthentication auth = new YggdrasilAuthenticationService(App.settings.getProxyForAuth(),
|
||||
account.getClientToken()).createUserAuthentication(Agent.MINECRAFT);
|
||||
UserAuthentication auth = new YggdrasilAuthenticationService(App.settings.proxy, account.getClientToken())
|
||||
.createUserAuthentication(Agent.MINECRAFT);
|
||||
LoginResponse response = new LoginResponse(account.getUsername());
|
||||
|
||||
if (!usePassword && account.hasStore()) {
|
||||
|
|
|
@ -57,10 +57,11 @@ public final class Hashing {
|
|||
}
|
||||
|
||||
public static long murmur(Path to) throws IOException {
|
||||
byte[] bytes = ArrayUtils.removeAllOccurences(
|
||||
ArrayUtils.removeAllOccurences(ArrayUtils.removeAllOccurences(
|
||||
ArrayUtils.removeAllOccurences(Files.readAllBytes(to), (byte) 9), (byte) 10), (byte) 13),
|
||||
(byte) 32);
|
||||
byte[] bytes = ArrayUtils
|
||||
.removeAllOccurrences(ArrayUtils.removeAllOccurrences(
|
||||
ArrayUtils.removeAllOccurrences(
|
||||
ArrayUtils.removeAllOccurrences(Files.readAllBytes(to), (byte) 9), (byte) 10),
|
||||
(byte) 13), (byte) 32);
|
||||
|
||||
return Murmur2.hash(bytes, bytes.length, 1L);
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ public class Java {
|
|||
* @return the Java version used to run Minecraft
|
||||
*/
|
||||
public static String getMinecraftJavaVersion() {
|
||||
if (App.settings.isUsingCustomJavaPath()) {
|
||||
File folder = new File(App.settings.getJavaPath(), "bin/");
|
||||
if (App.settings.usingCustomJavaPath) {
|
||||
File folder = new File(App.settings.javaPath, "bin/");
|
||||
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(getPathToMinecraftJavaExecutable(), "-version");
|
||||
processBuilder.directory(folder.getAbsoluteFile());
|
||||
|
@ -221,7 +221,7 @@ public class Java {
|
|||
}
|
||||
|
||||
public static String getPathToMinecraftJavaExecutable() {
|
||||
String path = App.settings.getJavaPath() + File.separator + "bin" + File.separator + "java";
|
||||
String path = App.settings.javaPath + File.separator + "bin" + File.separator + "java";
|
||||
|
||||
if (OS.isWindows()) {
|
||||
path += "w";
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Date;
|
|||
import com.atlauncher.App;
|
||||
|
||||
public final class Timestamper {
|
||||
private static final SimpleDateFormat format = new SimpleDateFormat(App.settings.getDateFormat() + " HH:mm:ss a");
|
||||
private static final SimpleDateFormat format = new SimpleDateFormat(App.settings.dateFormat + " HH:mm:ss a");
|
||||
|
||||
public static String now() {
|
||||
return format.format(new Date());
|
||||
|
|
|
@ -78,6 +78,7 @@ import javax.swing.ImageIcon;
|
|||
import com.atlauncher.App;
|
||||
import com.atlauncher.Gsons;
|
||||
import com.atlauncher.LogManager;
|
||||
import com.atlauncher.Network;
|
||||
import com.atlauncher.data.Constants;
|
||||
import com.atlauncher.data.minecraft.ExtractRule;
|
||||
import com.atlauncher.data.minecraft.FabricMod;
|
||||
|
@ -759,7 +760,7 @@ public class Utils {
|
|||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setRequestProperty("User-Agent", App.settings.getUserAgent());
|
||||
connection.setRequestProperty("User-Agent", Network.USER_AGENT);
|
||||
connection.setRequestProperty("Cache-Control", "no-store,max-age=0,no-cache");
|
||||
connection.setRequestProperty("Expires", "0");
|
||||
connection.setRequestProperty("Pragma", "no-cache");
|
||||
|
@ -797,7 +798,7 @@ public class Utils {
|
|||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setRequestProperty("User-Agent", App.settings.getUserAgent());
|
||||
connection.setRequestProperty("User-Agent", Network.USER_AGENT);
|
||||
connection.setRequestProperty("Content-Type", "application/json; charset=utf-8");
|
||||
connection.setRequestProperty("Cache-Control", "no-store,max-age=0,no-cache");
|
||||
connection.setRequestProperty("Expires", "0");
|
||||
|
@ -834,7 +835,7 @@ public class Utils {
|
|||
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setRequestProperty("User-Agent", App.settings.getUserAgent());
|
||||
connection.setRequestProperty("User-Agent", Network.USER_AGENT);
|
||||
connection.setRequestProperty("Content-Type", "application/json; charset=utf-8");
|
||||
connection.setRequestProperty("Cache-Control", "no-store,max-age=0,no-cache");
|
||||
connection.setRequestProperty("Expires", "0");
|
||||
|
@ -1069,7 +1070,7 @@ public class Utils {
|
|||
connection.setUseCaches(false);
|
||||
connection.setDefaultUseCaches(false);
|
||||
connection.setRequestProperty("Accept-Encoding", "gzip");
|
||||
connection.setRequestProperty("User-Agent", App.settings.getUserAgent());
|
||||
connection.setRequestProperty("User-Agent", Network.USER_AGENT);
|
||||
connection.setRequestProperty("Cache-Control", "no-store,max-age=0,no-cache");
|
||||
connection.setRequestProperty("Expires", "0");
|
||||
connection.setRequestProperty("Pragma", "no-cache");
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.zeroturnaround.zip.NameMapper;
|
|||
|
||||
public class ZipNameMapper {
|
||||
public static final NameMapper INSTANCE_BACKUP = name -> {
|
||||
if (App.settings.enableModsBackups()
|
||||
if (App.settings.enableModsBackups
|
||||
&& (name.startsWith("mods") || name.startsWith("jarmods") || name.startsWith("coremods"))) {
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -563,16 +563,16 @@ public class InstanceInstaller extends SwingWorker<Boolean, Void> implements Net
|
|||
instance.save();
|
||||
|
||||
if (this.instanceV2 != null) {
|
||||
App.settings.instancesV2.remove(this.instanceV2);
|
||||
App.launcher.instancesV2.remove(this.instanceV2);
|
||||
}
|
||||
|
||||
App.settings.instancesV2.add(instance);
|
||||
App.launcher.instancesV2.add(instance);
|
||||
|
||||
if (this.instance != null) {
|
||||
App.settings.instances.remove(this.instance);
|
||||
App.launcher.instances.remove(this.instance);
|
||||
}
|
||||
|
||||
App.settings.reloadInstancesPanel();
|
||||
App.launcher.reloadInstancesPanel();
|
||||
}
|
||||
|
||||
private void saveServerJson() {
|
||||
|
@ -591,9 +591,9 @@ public class InstanceInstaller extends SwingWorker<Boolean, Void> implements Net
|
|||
|
||||
server.save();
|
||||
|
||||
App.settings.servers.add(server);
|
||||
App.launcher.servers.add(server);
|
||||
|
||||
App.settings.reloadServersPanel();
|
||||
App.launcher.reloadServersPanel();
|
||||
}
|
||||
|
||||
private void determineMainClass() {
|
||||
|
|
Loading…
Reference in a new issue