chore: run formatter on all files and clean up gitignore

This commit is contained in:
Ryan Dowling 2021-07-24 15:27:30 +10:00
parent f67de53989
commit 227505ca8c
No known key found for this signature in database
GPG key ID: 5539FCDB88950EFD
39 changed files with 208 additions and 208 deletions

13
.gitignore vendored
View file

@ -5,17 +5,7 @@ build/
# Runtime
bin/
dist/
testLauncher/
run/
configs/
cache/
assets/
downloads/
minecraft/
libraries/
instances/
temp/
loaders/
# IDE Config
.idea/
@ -24,6 +14,9 @@ loaders/
.classpath
.project
# Launcher Test Run Directory
testLauncher/
# OS X
.DS_Store

View file

@ -26,4 +26,4 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
public @interface Json {
}
}

View file

@ -116,7 +116,8 @@ public class Constants {
public static final String LEGACY_JAVA_FIXER_MD5 = "12c337cb2445b56b097e7c25a5642710";
public static final String[] DATE_FORMATS = { "dd/MM/yyyy", "MM/dd/yyyy", "yyyy/MM/dd", "dd MMMM yyyy",
"dd-MM-yyyy", "MM-dd-yyyy", "yyyy-MM-dd" };
public static final String[] INSTANCE_TITLE_FORMATS = { "%1$s (%2$s %3$s)", "%1$s", "%1$s (%4$s)" }; // instance name, pack name, pack version, minecraft version
// instance name, pack name, pack version, minecraft version
public static final String[] INSTANCE_TITLE_FORMATS = { "%1$s (%2$s %3$s)", "%1$s", "%1$s (%4$s)" };
public static final String[] SCREEN_RESOLUTIONS = { "854x480", "1280x720", "1366x768", "1600x900", "1920x1080",
"2560x1440", "3440x1440", "3840x2160" };
public static final String DEFAULT_JAVA_PARAMETERS = "-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M";

View file

@ -32,5 +32,6 @@ public class UIConstants {
// CheckBoxes has 4 margin on it, so we negate that here so it aligns up without
// the need to remove that margin from all CheckBox components
public static final Insets CHECKBOX_FIELD_INSETS = new Insets(SPACING_LARGE, -SPACING_SMALL, SPACING_LARGE, 0);
public static final Insets CHECKBOX_FIELD_INSETS_SMALL = new Insets(SPACING_SMALL, -SPACING_SMALL, SPACING_SMALL, 0);
public static final Insets CHECKBOX_FIELD_INSETS_SMALL = new Insets(SPACING_SMALL, -SPACING_SMALL, SPACING_SMALL,
0);
}

View file

@ -18,8 +18,9 @@
package com.atlauncher.data;
/**
* Response to an API call made to ATLauncher servers. This contains information including if there was an error, the
* response code of the request, the error message (if any) and the data received (if any) from the API.
* Response to an API call made to ATLauncher servers. This contains information
* including if there was an error, the response code of the request, the error
* message (if any) and the data received (if any) from the API.
*/
public class APIResponse<T> {
/**
@ -30,7 +31,8 @@ public class APIResponse<T> {
/**
* The response code returned.
*
* @see <a href="http://wiki.atlauncher.com/api:response_code">http://wiki.atlauncher.com/api:response_code</a>
* @see <a href=
* "http://wiki.atlauncher.com/api:response_code">http://wiki.atlauncher.com/api:response_code</a>
*/
private int code;
@ -40,7 +42,8 @@ public class APIResponse<T> {
private String message;
/**
* The data sent back by the API (if applicable). Can be of various types and may not be specified at all.
* The data sent back by the API (if applicable). Can be of various types and
* may not be specified at all.
*/
private T data;
@ -57,7 +60,8 @@ public class APIResponse<T> {
* Gets the response code for this API response.
*
* @return the response code
* @see <a href="http://wiki.atlauncher.com/api:response_code">http://wiki.atlauncher.com/api:response_code</a>
* @see <a href=
* "http://wiki.atlauncher.com/api:response_code">http://wiki.atlauncher.com/api:response_code</a>
*/
public int getCode() {
return this.code;
@ -66,7 +70,8 @@ public class APIResponse<T> {
/**
* Gets the error message returned by the API.
*
* @return the error message received from the API if there was an error, or null if there was no error
* @return the error message received from the API if there was an error, or
* null if there was no error
*/
public String getMessage() {
return this.message;
@ -75,7 +80,8 @@ public class APIResponse<T> {
/**
* Gets the data returned by the API.
*
* @return the data returned from the API. Please note that this may not be set or be null.
* @return the data returned from the API. Please note that this may not be set
* or be null.
*/
public T getData() {
return this.data;

View file

@ -18,8 +18,9 @@
package com.atlauncher.data;
/**
* Response to an API call made to ATLauncher servers. This contains information including if there was an error, the
* response code of the request, the error message (if any) and the data received (if any) from the API.
* Response to an API call made to ATLauncher servers. This contains information
* including if there was an error, the response code of the request, the error
* message (if any) and the data received (if any) from the API.
*/
public class APIResponseInt {
/**
@ -30,7 +31,8 @@ public class APIResponseInt {
/**
* The response code returned.
*
* @see <a href="http://wiki.atlauncher.com/api:response_code">http://wiki.atlauncher.com/api:response_code</a>
* @see <a href=
* "http://wiki.atlauncher.com/api:response_code">http://wiki.atlauncher.com/api:response_code</a>
*/
private int code;
@ -40,7 +42,8 @@ public class APIResponseInt {
private String message;
/**
* The data sent back by the API (if applicable). Can be of various types and may not be specified at all.
* The data sent back by the API (if applicable). Can be of various types and
* may not be specified at all.
*/
private int data;
@ -57,7 +60,8 @@ public class APIResponseInt {
* Gets the response code for this API response.
*
* @return the response code
* @see <a href="http://wiki.atlauncher.com/api:response_code">http://wiki.atlauncher.com/api:response_code</a>
* @see <a href=
* "http://wiki.atlauncher.com/api:response_code">http://wiki.atlauncher.com/api:response_code</a>
*/
public int getCode() {
return this.code;
@ -66,7 +70,8 @@ public class APIResponseInt {
/**
* Gets the error message returned by the API.
*
* @return the error message received from the API if there was an error, or null if there was no error
* @return the error message received from the API if there was an error, or
* null if there was no error
*/
public String getMessage() {
return this.message;
@ -75,7 +80,8 @@ public class APIResponseInt {
/**
* Gets the data returned by the API.
*
* @return the data returned from the API. Please note that this may not be set or be null.
* @return the data returned from the API. Please note that this may not be set
* or be null.
*/
public int getData() {
return this.data;

View file

@ -275,40 +275,40 @@ public class DisableableMod implements Serializable {
dir = base.resolve(path).toFile();
} else {
switch (type) {
case jar:
case forge:
case mcpc:
dir = base.resolve("jarmods").toFile();
break;
case texturepack:
dir = base.resolve("texturepacks").toFile();
break;
case resourcepack:
dir = base.resolve("resourcepacks").toFile();
break;
case mods:
dir = base.resolve("mods").toFile();
break;
case ic2lib:
dir = base.resolve("mods/ic2").toFile();
break;
case denlib:
dir = base.resolve("mods/denlib").toFile();
break;
case coremods:
dir = base.resolve("coremods").toFile();
break;
case shaderpack:
dir = base.resolve("shaderpacks").toFile();
break;
case dependency:
if (mcVersion != null) {
dir = base.resolve("mods/" + mcVersion).toFile();
}
break;
default:
LogManager.warn("Unsupported mod for enabling/disabling " + this.name);
break;
case jar:
case forge:
case mcpc:
dir = base.resolve("jarmods").toFile();
break;
case texturepack:
dir = base.resolve("texturepacks").toFile();
break;
case resourcepack:
dir = base.resolve("resourcepacks").toFile();
break;
case mods:
dir = base.resolve("mods").toFile();
break;
case ic2lib:
dir = base.resolve("mods/ic2").toFile();
break;
case denlib:
dir = base.resolve("mods/denlib").toFile();
break;
case coremods:
dir = base.resolve("coremods").toFile();
break;
case shaderpack:
dir = base.resolve("shaderpacks").toFile();
break;
case dependency:
if (mcVersion != null) {
dir = base.resolve("mods/" + mcVersion).toFile();
}
break;
default:
LogManager.warn("Unsupported mod for enabling/disabling " + this.name);
break;
}
}
if (dir == null) {

View file

@ -19,4 +19,4 @@ package com.atlauncher.data;
public enum Download {
browser, direct, server
}
}

View file

@ -655,7 +655,7 @@ public class Instance extends MinecraftVersion {
return;
}
if(App.settings.enableCommands && App.settings.preLaunchCommand != null) {
if (App.settings.enableCommands && App.settings.preLaunchCommand != null) {
if (!executeCommand(App.settings.preLaunchCommand)) {
LogManager.error("Failed to execute pre-launch command");
@ -694,7 +694,7 @@ public class Instance extends MinecraftVersion {
return;
}
if(App.settings.enableCommands && App.settings.preLaunchCommand != null) {
if (App.settings.enableCommands && App.settings.preLaunchCommand != null) {
if (!executeCommand(App.settings.preLaunchCommand)) {
LogManager.error("Failed to execute pre-launch command");
@ -835,7 +835,7 @@ public class Instance extends MinecraftVersion {
MinecraftError.showInformationPopup(detectedError);
}
if(App.settings.enableCommands && App.settings.postExitCommand != null) {
if (App.settings.enableCommands && App.settings.postExitCommand != null) {
if (!executeCommand(App.settings.postExitCommand)) {
LogManager.error("Failed to execute post-exit command");
}
@ -877,20 +877,17 @@ public class Instance extends MinecraftVersion {
try {
CommandExecutor.executeCommand(this, command);
return true;
}
catch (CommandException e) {
} catch (CommandException e) {
String content = GetText.tr("Error executing command");
if(e.getMessage() != null)
{
if (e.getMessage() != null) {
content += ":" + System.lineSeparator() + e.getLocalizedMessage();
}
content += System.lineSeparator() + GetText.tr("Check the console for details");
DialogManager.okDialog().setTitle(GetText.tr("Error executing command"))
.setContent(content)
.setType(DialogManager.ERROR).show();
DialogManager.okDialog().setTitle(GetText.tr("Error executing command")).setContent(content)
.setType(DialogManager.ERROR).show();
return false;
}

View file

@ -151,8 +151,7 @@ public class MinecraftServer {
if (this.playersOnline == -1) {
return GetText.tr("Offline");
} else {
return GetText.tr("Online") + " - " + this.getPrintablePlayersOnline()
+ " Players";
return GetText.tr("Online") + " - " + this.getPrintablePlayersOnline() + " Players";
}
}

View file

@ -20,7 +20,9 @@ package com.atlauncher.data;
import com.google.gson.annotations.SerializedName;
public enum ModPlatform {
@SerializedName("CurseForge")CURSEFORGE,
@SerializedName("CurseForge")
CURSEFORGE,
@SerializedName("Modrinth")MODRINTH
@SerializedName("Modrinth")
MODRINTH
}

View file

@ -20,7 +20,8 @@ package com.atlauncher.data;
import com.google.gson.annotations.SerializedName;
public enum PackType {
@SerializedName("public")PUBLIC,
@SerializedName("private")PRIVATE,
@SerializedName("semipublic")SEMIPUBLIC
@SerializedName("public")
PUBLIC, @SerializedName("private")
PRIVATE, @SerializedName("semipublic")
SEMIPUBLIC
}

View file

@ -119,7 +119,7 @@ public class Settings {
public boolean enableAutomaticBackupAfterLaunch = false;
public BackupMode backupMode = BackupMode.NORMAL;
//Commands
// Commands
public boolean enableCommands = false;
public String preLaunchCommand = null;
public String postExitCommand = null;

View file

@ -156,7 +156,8 @@ public abstract class Installable {
final InstanceInstaller instanceInstaller = new InstanceInstaller(instanceName, pack, version, isReinstall,
isServer, saveMods, null, showModsChooser, loaderVersion, curseForgeManifest, curseExtractedPath,
modpacksChPackManifest, modrinthManifest, modrinthExtractedPath, multiMCManifest, multiMCExtractedPath) {
modpacksChPackManifest, modrinthManifest, modrinthExtractedPath, multiMCManifest,
multiMCExtractedPath) {
protected void done() {
Boolean success = false;

View file

@ -91,20 +91,20 @@ public class Action {
instanceInstaller.temp.resolve("actions").toFile());
}
switch (this.type) {
case mods:
Utils.zip(instanceInstaller.temp.resolve("actions").toFile(),
new File(instanceInstaller.root.resolve("mods").toFile(), saveAs));
break;
case coremods:
Utils.zip(instanceInstaller.temp.resolve("actions").toFile(),
new File(instanceInstaller.root.resolve("coremods").toFile(), saveAs));
break;
case jar:
Utils.zip(instanceInstaller.temp.resolve("actions").toFile(),
new File(instanceInstaller.root.resolve("jarmods").toFile(), saveAs));
break;
default:
break;
case mods:
Utils.zip(instanceInstaller.temp.resolve("actions").toFile(),
new File(instanceInstaller.root.resolve("mods").toFile(), saveAs));
break;
case coremods:
Utils.zip(instanceInstaller.temp.resolve("actions").toFile(),
new File(instanceInstaller.root.resolve("coremods").toFile(), saveAs));
break;
case jar:
Utils.zip(instanceInstaller.temp.resolve("actions").toFile(),
new File(instanceInstaller.root.resolve("jarmods").toFile(), saveAs));
break;
default:
break;
}
}
} else if (this.action == TheAction.rename) {

View file

@ -27,7 +27,7 @@ import com.atlauncher.workers.InstanceInstaller;
public interface Loader {
void set(Map<String, Object> metadata, File tempDir, InstanceInstaller instanceInstaller,
LoaderVersion versionOverride);
LoaderVersion versionOverride);
void downloadAndExtractInstaller() throws Exception;

View file

@ -22,8 +22,8 @@ import com.atlauncher.utils.Utils;
import org.mini2Dx.gettext.GetText;
/**
* The Class OpenEyeReportResponse contains information returned from OpenMods OpenEye system when a pending crash
* report is reported through their API.
* The Class OpenEyeReportResponse contains information returned from OpenMods
* OpenEye system when a pending crash report is reported through their API.
*/
public class OpenEyeReportResponse {
/**
@ -37,8 +37,8 @@ public class OpenEyeReportResponse {
private String url;
/**
* The note added to the crash, added by the mods developer, if any. Will return null if there has been no note
* added.
* The note added to the crash, added by the mods developer, if any. Will return
* null if there has been no note added.
*/
private String note;
@ -85,8 +85,8 @@ public class OpenEyeReportResponse {
*/
public String getNoteDisplay() {
if (this.hasNote()) {
return GetText.tr("A note attached to the crash can be seen below:") + "<br/><br/>" + Utils.splitMultilinedString
(this.getNote(), 100, "<br/>") + "<br/><br/>";
return GetText.tr("A note attached to the crash can be seen below:") + "<br/><br/>"
+ Utils.splitMultilinedString(this.getNote(), 100, "<br/>") + "<br/><br/>";
} else {
return GetText.tr("There is no note attached to this crash.") + "<br/><br/>";
}

View file

@ -19,4 +19,4 @@ package com.atlauncher.evnt.listener;
public interface ConsoleCloseListener {
void onConsoleClose();
}
}

View file

@ -19,4 +19,4 @@ package com.atlauncher.evnt.listener;
public interface ConsoleOpenListener {
void onConsoleOpen();
}
}

View file

@ -19,4 +19,4 @@ package com.atlauncher.evnt.listener;
public interface MinecraftLandListener {
}
}

View file

@ -19,4 +19,4 @@ package com.atlauncher.evnt.listener;
public interface MinecraftLaunchListener {
}
}

View file

@ -19,4 +19,4 @@ package com.atlauncher.evnt.listener;
public interface ReskinListener {
void onReskin();
}
}

View file

@ -19,4 +19,4 @@ package com.atlauncher.evnt.listener;
public interface TabChangeListener {
void on();
}
}

View file

@ -17,30 +17,24 @@
*/
package com.atlauncher.exceptions;
public class CommandException extends RuntimeException
{
public CommandException()
{
public class CommandException extends RuntimeException {
public CommandException() {
super();
}
public CommandException(String message)
{
public CommandException(String message) {
super(message);
}
public CommandException(String message, Throwable cause)
{
public CommandException(String message, Throwable cause) {
super(message, cause);
}
public CommandException(Throwable cause)
{
public CommandException(Throwable cause) {
super(cause);
}
protected CommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)
{
protected CommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View file

@ -39,8 +39,7 @@ import org.mini2Dx.gettext.GetText;
*/
@SuppressWarnings("serial")
public class NilCard extends JPanel implements RelocalizationListener {
private static final Image defaultImage = Utils.getIconImage("/assets/image/nil-card-image.png")
.getImage();
private static final Image defaultImage = Utils.getIconImage("/assets/image/nil-card-image.png").getImage();
private final JTextArea error = new JTextArea();
@ -49,7 +48,7 @@ public class NilCard extends JPanel implements RelocalizationListener {
RelocalizationManager.addListener(this);
this.setBorder(new TitledBorder(null, GetText.tr("Nothing To Show"), TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, App.THEME.getBoldFont().deriveFont(15f)));
TitledBorder.DEFAULT_POSITION, App.THEME.getBoldFont().deriveFont(15f)));
this.error.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
this.error.setEditable(false);

View file

@ -53,9 +53,7 @@ public class DropDownButton extends JButton {
@Override
public void paint(Graphics g) {
super.paint(g);
g.drawImage(
Utils.getIconImage(App.THEME.getIconPath((popupMenu.isShowing() ? "expanded" : "collapsed")))
.getImage(),
getWidth() - 20, ((getHeight() - 12) / 2), null);
g.drawImage(Utils.getIconImage(App.THEME.getIconPath((popupMenu.isShowing() ? "expanded" : "collapsed")))
.getImage(), getWidth() - 20, ((getHeight() - 12) / 2), null);
}
}

View file

@ -53,13 +53,11 @@ import com.atlauncher.data.curseforge.CurseForgeFingerprint;
import com.atlauncher.data.curseforge.CurseForgeFingerprintedMod;
import com.atlauncher.data.minecraft.FabricMod;
import com.atlauncher.data.minecraft.MCMod;
import com.atlauncher.exceptions.InvalidMinecraftVersion;
import com.atlauncher.gui.components.ModsJCheckBox;
import com.atlauncher.gui.handlers.ModsJCheckBoxTransferHandler;
import com.atlauncher.gui.layouts.WrapLayout;
import com.atlauncher.managers.DialogManager;
import com.atlauncher.managers.LogManager;
import com.atlauncher.managers.MinecraftManager;
import com.atlauncher.managers.PerformanceManager;
import com.atlauncher.network.Analytics;
import com.atlauncher.utils.CurseForgeApi;

View file

@ -97,6 +97,7 @@ public class ProgressDialog<T> extends JDialog implements NetworkProgressable {
}
});
}
public ProgressDialog(String title, int initMax, String initLabelText, String initClosedLogMessage,
boolean showProgressBar) {
this(title, initMax, initLabelText, initClosedLogMessage, showProgressBar, App.launcher.getParent());

View file

@ -54,9 +54,9 @@ public class SettingsTab extends JPanel implements Tab, RelocalizationListener {
private final ToolsSettingsTab toolsSettingsTab = new ToolsSettingsTab();
private final BackupsSettingsTab backupsSettingsTab = new BackupsSettingsTab();
private final CommandSettingsTab commandSettingsTab = new CommandSettingsTab();
private final List<Tab> tabs = Arrays
.asList(new Tab[] { this.generalSettingsTab, this.modsSettingsTab, this.javaSettingsTab,
this.networkSettingsTab, this.loggingSettingsTab, this.toolsSettingsTab, this.backupsSettingsTab, this.commandSettingsTab });
private final List<Tab> tabs = Arrays.asList(
new Tab[] { this.generalSettingsTab, this.modsSettingsTab, this.javaSettingsTab, this.networkSettingsTab,
this.loggingSettingsTab, this.toolsSettingsTab, this.backupsSettingsTab, this.commandSettingsTab });
private final JTabbedPane tabbedPane;
private final JButton saveButton = new JButton(GetText.tr("Save"));

View file

@ -19,4 +19,4 @@ package com.atlauncher.gui.tabs;
public interface Tab {
String getTitle();
}
}

View file

@ -46,12 +46,9 @@ public class CommandSettingsTab extends AbstractSettingsTab implements ActionLis
gbc.insets = UIConstants.LABEL_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
//region Enable Checkbox
JLabel enableCommandsLabel = new JLabelWithHover(
GetText.tr("Enable commands") + "?",
HELP_ICON,
GetText.tr("This allows you to turn launch/exit commands on or off.")
);
// region Enable Checkbox
JLabel enableCommandsLabel = new JLabelWithHover(GetText.tr("Enable commands") + "?", HELP_ICON,
GetText.tr("This allows you to turn launch/exit commands on or off."));
add(enableCommandsLabel, gbc);
nextColumn();
@ -62,13 +59,12 @@ public class CommandSettingsTab extends AbstractSettingsTab implements ActionLis
add(enableCommands, gbc);
nextRow();
//endregion
// endregion
//region Pre-launch command
JLabelWithHover preLaunchCommandLabel = new JLabelWithHover(
GetText.tr("Pre-launch command") + ":",
HELP_ICON,
GetText.tr("This command will be run before the instance launches. The game will not run until the command has finished."));
// region Pre-launch command
JLabelWithHover preLaunchCommandLabel = new JLabelWithHover(GetText.tr("Pre-launch command") + ":", HELP_ICON,
GetText.tr(
"This command will be run before the instance launches. The game will not run until the command has finished."));
add(preLaunchCommandLabel, gbc);
nextColumn();
@ -78,13 +74,12 @@ public class CommandSettingsTab extends AbstractSettingsTab implements ActionLis
add(preLaunchCommand, gbc);
nextRow();
//endregion
// endregion
//region Post-exit command
JLabelWithHover postExitCommandLabel = new JLabelWithHover(
GetText.tr("Post-exit command") + ":",
HELP_ICON,
GetText.tr("This command will be run after the instance exits. It will run even if the instance is killed or if it crashes and exits."));
// region Post-exit command
JLabelWithHover postExitCommandLabel = new JLabelWithHover(GetText.tr("Post-exit command") + ":", HELP_ICON,
GetText.tr(
"This command will be run after the instance exits. It will run even if the instance is killed or if it crashes and exits."));
add(postExitCommandLabel, gbc);
nextColumn();
@ -94,27 +89,29 @@ public class CommandSettingsTab extends AbstractSettingsTab implements ActionLis
add(postExitCommand, gbc);
nextRow();
//endregion
// endregion
//region Information text pane
// region Information text pane
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.anchor = GridBagConstraints.CENTER;
JTextPane parameterInformation = new JTextPane();
parameterInformation.setText(
GetText.tr("Commands will be run in the directory of the instance that is launched/exited.") + System.lineSeparator()
+ GetText.tr("The following variables are available for each command") + ":" + System.lineSeparator()
+ "$INST_NAME: " + GetText.tr("The name of the instance") + System.lineSeparator()
+ "$INST_ID: " + GetText.tr("The name of the instance's root directory") + System.lineSeparator()
+ "$INST_DIR: " + GetText.tr("The absolute path to the instance directory") + System.lineSeparator()
+ "$INST_MC_DIR: " + GetText.tr("Alias for") + " $INST_DIR" + System.lineSeparator()
+ "$INST_JAVA: " + GetText.tr("The absolute path to the java executable used for launch") + System.lineSeparator()
+ "$INST_JAVA_ARGS: " + GetText.tr("The JVM parameters used for launch") + System.lineSeparator()
);
parameterInformation
.setText(GetText.tr("Commands will be run in the directory of the instance that is launched/exited.")
+ System.lineSeparator() + GetText.tr("The following variables are available for each command")
+ ":" + System.lineSeparator() + "$INST_NAME: " + GetText.tr("The name of the instance")
+ System.lineSeparator() + "$INST_ID: "
+ GetText.tr("The name of the instance's root directory") + System.lineSeparator()
+ "$INST_DIR: " + GetText.tr("The absolute path to the instance directory")
+ System.lineSeparator() + "$INST_MC_DIR: " + GetText.tr("Alias for") + " $INST_DIR"
+ System.lineSeparator() + "$INST_JAVA: "
+ GetText.tr("The absolute path to the java executable used for launch")
+ System.lineSeparator() + "$INST_JAVA_ARGS: "
+ GetText.tr("The JVM parameters used for launch") + System.lineSeparator());
parameterInformation.setEditable(false);
add(parameterInformation, gbc);
//endregion
// endregion
if (enableCommands.isSelected())
enableCommands();
@ -157,8 +154,10 @@ public class CommandSettingsTab extends AbstractSettingsTab implements ActionLis
}
private String nullIfEmpty(String str) {
if (str.isEmpty()) return null;
else return str;
if (str.isEmpty())
return null;
else
return str;
}
@Override

View file

@ -45,8 +45,9 @@ public class LoggingSettingsTab extends AbstractSettingsTab {
gbc.gridy++;
gbc.insets = UIConstants.LABEL_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
JLabelWithHover forgeLoggingLevelLabel = new JLabelWithHover(GetText.tr("Forge Logging Level") + ":", HELP_ICON, "<html>"
+ GetText.tr("This determines the type of logging that Forge should report back to you.") + "</html>");
JLabelWithHover forgeLoggingLevelLabel = new JLabelWithHover(GetText.tr("Forge Logging Level") + ":", HELP_ICON,
"<html>" + GetText.tr("This determines the type of logging that Forge should report back to you.")
+ "</html>");
add(forgeLoggingLevelLabel, gbc);
gbc.gridx++;
@ -70,9 +71,9 @@ public class LoggingSettingsTab extends AbstractSettingsTab {
gbc.insets = UIConstants.LABEL_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
JLabelWithHover enableLoggingLabel = new JLabelWithHover(GetText.tr("Enable Logging") + "?", HELP_ICON,
new HTMLBuilder().center().split(100).text(GetText.tr(
"The Launcher sends back anonymous usage and error logs to our servers in order to make the Launcher and Packs better. If you don't want this to happen then simply disable this option."))
.build());
new HTMLBuilder().center().split(100).text(GetText.tr(
"The Launcher sends back anonymous usage and error logs to our servers in order to make the Launcher and Packs better. If you don't want this to happen then simply disable this option."))
.build());
add(enableLoggingLabel, gbc);
gbc.gridx++;
@ -99,10 +100,11 @@ public class LoggingSettingsTab extends AbstractSettingsTab {
gbc.gridy++;
gbc.insets = UIConstants.LABEL_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
JLabelWithHover enableAnalyticsLabel = new JLabelWithHover(GetText.tr("Enable Anonymous Analytics") + "?", HELP_ICON,
new HTMLBuilder().center().split(100).text(GetText.tr(
"The Launcher sends back anonymous analytics to Google Analytics in order to track what people do and don't use in the launcher. This helps determine what new features we implement in the future. All analytics are anonymous and contain no user/instance information in it at all. If you don't want to send anonymous analytics, you can disable this option."))
.build());
JLabelWithHover enableAnalyticsLabel = new JLabelWithHover(GetText.tr("Enable Anonymous Analytics") + "?",
HELP_ICON,
new HTMLBuilder().center().split(100).text(GetText.tr(
"The Launcher sends back anonymous analytics to Google Analytics in order to track what people do and don't use in the launcher. This helps determine what new features we implement in the future. All analytics are anonymous and contain no user/instance information in it at all. If you don't want to send anonymous analytics, you can disable this option."))
.build());
add(enableAnalyticsLabel, gbc);
gbc.gridx++;
@ -120,10 +122,11 @@ public class LoggingSettingsTab extends AbstractSettingsTab {
gbc.gridy++;
gbc.insets = UIConstants.LABEL_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
JLabelWithHover enableOpenEyeReportingLabel = new JLabelWithHover(GetText.tr("Enable OpenEye Reporting") + "?", HELP_ICON,
new HTMLBuilder().center().split(100).text(GetText.tr(
"OpenEye is a mod/project created by the OpenMods team which aims to help gather statistics and crash logs from Minecraft in order to help users and modders discover and fix issues with mods. With the OpenEye mod installed (each ModPack chooses if they wish to install it or not, it's not installed by default to all packs by the Launcher) everytime Minecraft crashes the OpenEye report is sent to OpenEye for analysis and if a note from the modder has been added on the cause/fix it will be displayed to you. For more information please see http://openeye.openblocks.info"))
.build());
JLabelWithHover enableOpenEyeReportingLabel = new JLabelWithHover(GetText.tr("Enable OpenEye Reporting") + "?",
HELP_ICON,
new HTMLBuilder().center().split(100).text(GetText.tr(
"OpenEye is a mod/project created by the OpenMods team which aims to help gather statistics and crash logs from Minecraft in order to help users and modders discover and fix issues with mods. With the OpenEye mod installed (each ModPack chooses if they wish to install it or not, it's not installed by default to all packs by the Launcher) everytime Minecraft crashes the OpenEye report is sent to OpenEye for analysis and if a note from the modder has been added on the cause/fix it will be displayed to you. For more information please see http://openeye.openblocks.info"))
.build());
add(enableOpenEyeReportingLabel, gbc);
gbc.gridx++;

View file

@ -38,8 +38,8 @@ public class LogClearerToolPanel extends AbstractToolPanel implements ActionList
super(GetText.tr("Log Clearer"));
JLabel INFO_LABEL = new JLabel(new HTMLBuilder().center().split(70).text(GetText.tr(
"This tool clears out all logs created by the launcher (not included those made by instances) to free up space and old junk."))
.build());
"This tool clears out all logs created by the launcher (not included those made by instances) to free up space and old junk."))
.build());
MIDDLE_PANEL.add(INFO_LABEL);
BOTTOM_PANEL.add(LAUNCH_BUTTON);
LAUNCH_BUTTON.addActionListener(this);

View file

@ -38,8 +38,8 @@ public class ServerCheckerToolPanel extends AbstractToolPanel implements ActionL
super(GetText.tr("Server Checker"));
JLabel INFO_LABEL = new JLabel(new HTMLBuilder().center().split(70).text(GetText.tr(
"This tool checks specified Minecraft servers to see if they are up or not and how many players are logged in. Settings can be configured in the Settings tab under the Tools sub tab."))
.build());
"This tool checks specified Minecraft servers to see if they are up or not and how many players are logged in. Settings can be configured in the Settings tab under the Tools sub tab."))
.build());
MIDDLE_PANEL.add(INFO_LABEL);
BOTTOM_PANEL.add(LAUNCH_BUTTON);
LAUNCH_BUTTON.addActionListener(this);

View file

@ -24,7 +24,6 @@ import javax.swing.JLabel;
import com.atlauncher.Data;
import com.atlauncher.builders.HTMLBuilder;
import com.atlauncher.constants.Constants;
import com.atlauncher.evnt.listener.AccountListener;
import com.atlauncher.evnt.manager.AccountManager;
import com.atlauncher.gui.dialogs.ProgressDialog;

View file

@ -55,7 +55,8 @@ public class NewsManager {
java.lang.reflect.Type type = new TypeToken<List<News>>() {
}.getType();
File fileDir = FileSystem.JSON.resolve("newnews.json").toFile();
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), StandardCharsets.UTF_8));
BufferedReader in = new BufferedReader(
new InputStreamReader(new FileInputStream(fileDir), StandardCharsets.UTF_8));
Data.NEWS.addAll(Gsons.DEFAULT.fromJson(in, type));
in.close();

View file

@ -33,18 +33,20 @@ import com.atlauncher.managers.LogManager;
public class CommandExecutor {
/**
* Runs the specified {@code command} in the system command line.
* Substitutes <br/>
* Runs the specified {@code command} in the system command line. Substitutes
* <br/>
* "$INST_NAME" with the name of the specified {@code instance}, <br/>
* "$INST_ID" with the name of the instance's root directory, <br/>
* "$INST_DIR" with the absolute path the the instance directory
* "$INST_JAVA" with the absolute path to the java binary used to run the instance, <br/>
* "$INST_JAVA_ARGS" with the JVM arguments (e.g. "-Xmx3G", NOT the arguments used to launch the game, containing account information), <br/>
* "$INST_DIR" with the absolute path the the instance directory "$INST_JAVA"
* with the absolute path to the java binary used to run the instance, <br/>
* "$INST_JAVA_ARGS" with the JVM arguments (e.g. "-Xmx3G", NOT the arguments
* used to launch the game, containing account information), <br/>
* in the specified command, then runs it on the command line.
*
* @param instance The instance to run the command for
* @param command The command to run on the command line
* @throws CommandException If the process exits with a non zero value or another error occurs when trying to run the command
* @throws CommandException If the process exits with a non zero value or
* another error occurs when trying to run the command
*/
public static void executeCommand(Instance instance, String command) {
if (command == null)
@ -66,7 +68,7 @@ public class CommandExecutor {
throw new CommandException();
}
} catch (IOException | InterruptedException e ) {
} catch (IOException | InterruptedException e) {
LogManager.logStackTrace(e);
throw new CommandException(e);
}
@ -79,17 +81,15 @@ public class CommandExecutor {
String line;
while ((line = reader.readLine()) != null) {
LogManager.info(line);
LogManager.info(line);
}
}
catch(Exception e)
{
} catch (Exception e) {
LogManager.logStackTrace(e);
//throw new RuntimeException(e);
// throw new RuntimeException(e);
}
}
//print the whole thing as 1 message rather than line by line
// print the whole thing as 1 message rather than line by line
private static void printErrorStreamToConsole(InputStream stream) {
try {
boolean hasGotFirstContentLine = false;
@ -99,26 +99,26 @@ public class CommandExecutor {
String line;
while ((line = reader.readLine()) != null) {
//cut off any initial blank lines
if(!line.isEmpty() || hasGotFirstContentLine) {
// cut off any initial blank lines
if (!line.isEmpty() || hasGotFirstContentLine) {
hasGotFirstContentLine = true;
message.append(line).append(System.lineSeparator());
}
}
LogManager.error(message.toString());
}
catch(Exception e)
{
} catch (Exception e) {
LogManager.logStackTrace(e);
//throw new RuntimeException(e);
// throw new RuntimeException(e);
}
}
/**
* Substitutes all tokens beginning with '$' (and in all capitals) with the matching key in {@code tokens} if it exists
* Substitutes all tokens beginning with '$' (and in all capitals) with the
* matching key in {@code tokens} if it exists
*
* @param tokens All the keys that will be replaced with their value in {@code command}
* @param tokens All the keys that will be replaced with their value in
* {@code command}
* @param command The string to substitute into
* @return The string with all tokens substituted
*/

View file

@ -54,7 +54,8 @@ public class MCQuery {
} catch (Exception ignored) {
}
// 1.7 must be queried last because if not, the rest of the checks will ALWAYS fail for some
// 1.7 must be queried last because if not, the rest of the checks will ALWAYS
// fail for some
// reason of which I'm not sure of yet
try {
ServerListPing17 ping17 = new ServerListPing17();

View file

@ -61,4 +61,4 @@ public final class LogEventWriter implements Closeable, Flushable {
public void close() throws IOException {
this.writer.close();
}
}
}