fix: lint

This commit is contained in:
huanghongxun 2021-05-29 15:15:40 +08:00
parent 2a0cfb1125
commit e01096bff0
3 changed files with 20 additions and 22 deletions

View File

@ -67,7 +67,7 @@ public final class VersionSetting implements Cloneable {
* 1. Global settings. * 1. Global settings.
* 2. Version settings. * 2. Version settings.
* If a version claims that it uses global settings, its version setting will be disabled. * If a version claims that it uses global settings, its version setting will be disabled.
* * <p>
* Defaults false because if one version uses global first, custom version file will not be generated. * Defaults false because if one version uses global first, custom version file will not be generated.
*/ */
public boolean isUsesGlobal() { public boolean isUsesGlobal() {
@ -141,15 +141,15 @@ public final class VersionSetting implements Cloneable {
private final StringProperty nativesDirProperty = new SimpleStringProperty(this, "nativesDirProperty", ""); private final StringProperty nativesDirProperty = new SimpleStringProperty(this, "nativesDirProperty", "");
public StringProperty nativesDirProperty(){ public StringProperty nativesDirProperty() {
return nativesDirProperty; return nativesDirProperty;
} }
public String getNativesDir(){ public String getNativesDir() {
return nativesDirProperty.get(); return nativesDirProperty.get();
} }
public void setNativesDir(String nativesDir){ public void setNativesDir(String nativesDir) {
nativesDirProperty.set(nativesDir); nativesDirProperty.set(nativesDir);
} }
@ -370,7 +370,7 @@ public final class VersionSetting implements Cloneable {
/** /**
* The server ip that will be entered after Minecraft successfully loaded ly. * The server ip that will be entered after Minecraft successfully loaded ly.
* * <p>
* Format: ip:port or without port. * Format: ip:port or without port.
*/ */
public String getServerIp() { public String getServerIp() {
@ -407,7 +407,7 @@ public final class VersionSetting implements Cloneable {
/** /**
* The width of Minecraft window, defaults 800. * The width of Minecraft window, defaults 800.
* * <p>
* The field saves int value. * The field saves int value.
* String type prevents unexpected value from JsonParseException. * String type prevents unexpected value from JsonParseException.
* We can only reset this field instead of recreating the whole setting file. * We can only reset this field instead of recreating the whole setting file.
@ -429,7 +429,7 @@ public final class VersionSetting implements Cloneable {
/** /**
* The height of Minecraft window, defaults 480. * The height of Minecraft window, defaults 480.
* * <p>
* The field saves int value. * The field saves int value.
* String type prevents unexpected value from JsonParseException. * String type prevents unexpected value from JsonParseException.
* We can only reset this field instead of recreating the whole setting file. * We can only reset this field instead of recreating the whole setting file.

View File

@ -206,17 +206,17 @@ public class LaunchOptions implements Serializable {
* 0 - ./minecraft/versions/&lt;version&gt;/natives * 0 - ./minecraft/versions/&lt;version&gt;/natives
* 1 - custom natives directory * 1 - custom natives directory
*/ */
public NativesDirectoryType getNativesDirType(){ public NativesDirectoryType getNativesDirType() {
return nativesDirType; return nativesDirType;
} }
/** /**
* Path to the natives directory, optional * Path to the natives directory, optional
*/ */
public String getNativesDir(){ public String getNativesDir() {
return nativesDir; return nativesDir;
} }
public static class Builder { public static class Builder {
private final LaunchOptions options = new LaunchOptions(); private final LaunchOptions options = new LaunchOptions();
@ -369,11 +369,11 @@ public class LaunchOptions implements Serializable {
return options.preLaunchCommand; return options.preLaunchCommand;
} }
public NativesDirectoryType getNativesDirType(){ public NativesDirectoryType getNativesDirType() {
return options.nativesDirType; return options.nativesDirType;
} }
public String getNativesDir(){ public String getNativesDir() {
return options.nativesDir; return options.nativesDir;
} }
@ -479,12 +479,12 @@ public class LaunchOptions implements Serializable {
return this; return this;
} }
public Builder setNativesDirType(NativesDirectoryType nativesDirType){ public Builder setNativesDirType(NativesDirectoryType nativesDirType) {
options.nativesDirType = nativesDirType; options.nativesDirType = nativesDirType;
return this; return this;
} }
public Builder setNativesDir(String nativesDir){ public Builder setNativesDir(String nativesDir) {
options.nativesDir = nativesDir; options.nativesDir = nativesDir;
return this; return this;
} }

View File

@ -303,11 +303,10 @@ public class DefaultLauncher extends Launcher {
File nativeFolder = null; File nativeFolder = null;
if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) { if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) {
nativeFolder = repository.getNativeDirectory(version.getId()); nativeFolder = repository.getNativeDirectory(version.getId());
} } else {
else {
nativeFolder = new File(options.getNativesDir()); nativeFolder = new File(options.getNativesDir());
} }
// To guarantee that when failed to generate launch command line, we will not call pre-launch command // To guarantee that when failed to generate launch command line, we will not call pre-launch command
List<String> rawCommandLine = generateCommandLine(nativeFolder).asList(); List<String> rawCommandLine = generateCommandLine(nativeFolder).asList();
@ -317,7 +316,7 @@ public class DefaultLauncher extends Launcher {
if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) { if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) {
decompressNatives(nativeFolder); decompressNatives(nativeFolder);
} }
File runDirectory = repository.getRunDirectory(version.getId()); File runDirectory = repository.getRunDirectory(version.getId());
@ -360,14 +359,13 @@ public class DefaultLauncher extends Launcher {
File nativeFolder = null; File nativeFolder = null;
if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) { if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) {
nativeFolder = repository.getNativeDirectory(version.getId()); nativeFolder = repository.getNativeDirectory(version.getId());
} } else {
else {
nativeFolder = new File(options.getNativesDir()); nativeFolder = new File(options.getNativesDir());
} }
if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) { if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) {
decompressNatives(nativeFolder); decompressNatives(nativeFolder);
} }
if (isWindows && !FileUtils.getExtension(scriptFile).equals("bat")) if (isWindows && !FileUtils.getExtension(scriptFile).equals("bat"))
throw new IllegalArgumentException("The extension of " + scriptFile + " is not 'bat' in Windows"); throw new IllegalArgumentException("The extension of " + scriptFile + " is not 'bat' in Windows");