diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionSetting.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionSetting.java index 4cdd9b6001..7de512572a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionSetting.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionSetting.java @@ -67,7 +67,7 @@ public BooleanProperty usesGlobalProperty() { * 1. Global settings. * 2. Version settings. * If a version claims that it uses global settings, its version setting will be disabled. - * + *

* Defaults false because if one version uses global first, custom version file will not be generated. */ public boolean isUsesGlobal() { @@ -141,15 +141,15 @@ public void setNativesDirType(NativesDirectoryType nativesDirType) { private final StringProperty nativesDirProperty = new SimpleStringProperty(this, "nativesDirProperty", ""); - public StringProperty nativesDirProperty(){ + public StringProperty nativesDirProperty() { return nativesDirProperty; } - public String getNativesDir(){ + public String getNativesDir() { return nativesDirProperty.get(); } - public void setNativesDir(String nativesDir){ + public void setNativesDir(String nativesDir) { nativesDirProperty.set(nativesDir); } @@ -370,7 +370,7 @@ public StringProperty serverIpProperty() { /** * The server ip that will be entered after Minecraft successfully loaded ly. - * + *

* Format: ip:port or without port. */ public String getServerIp() { @@ -407,7 +407,7 @@ public IntegerProperty widthProperty() { /** * The width of Minecraft window, defaults 800. - * + *

* The field saves int value. * String type prevents unexpected value from JsonParseException. * We can only reset this field instead of recreating the whole setting file. @@ -429,7 +429,7 @@ public IntegerProperty heightProperty() { /** * The height of Minecraft window, defaults 480. - * + *

* The field saves int value. * String type prevents unexpected value from JsonParseException. * We can only reset this field instead of recreating the whole setting file. diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchOptions.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchOptions.java index de31799f4c..39d261e6c0 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchOptions.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchOptions.java @@ -206,17 +206,17 @@ public String getPreLaunchCommand() { * 0 - ./minecraft/versions/<version>/natives * 1 - custom natives directory */ - public NativesDirectoryType getNativesDirType(){ + public NativesDirectoryType getNativesDirType() { return nativesDirType; } /** * Path to the natives directory, optional */ - public String getNativesDir(){ + public String getNativesDir() { return nativesDir; } - + public static class Builder { private final LaunchOptions options = new LaunchOptions(); @@ -369,11 +369,11 @@ public String getPreLaunchCommand() { return options.preLaunchCommand; } - public NativesDirectoryType getNativesDirType(){ + public NativesDirectoryType getNativesDirType() { return options.nativesDirType; } - public String getNativesDir(){ + public String getNativesDir() { return options.nativesDir; } @@ -479,12 +479,12 @@ public Builder setPrecalledCommand(String precalledCommand) { return this; } - public Builder setNativesDirType(NativesDirectoryType nativesDirType){ + public Builder setNativesDirType(NativesDirectoryType nativesDirType) { options.nativesDirType = nativesDirType; return this; } - public Builder setNativesDir(String nativesDir){ + public Builder setNativesDir(String nativesDir) { options.nativesDir = nativesDir; return this; } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java index 405aed6efa..bef11c9e8f 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java @@ -303,11 +303,10 @@ public ManagedProcess launch() throws IOException, InterruptedException { File nativeFolder = null; if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) { nativeFolder = repository.getNativeDirectory(version.getId()); - } - else { + } else { nativeFolder = new File(options.getNativesDir()); } - + // To guarantee that when failed to generate launch command line, we will not call pre-launch command List rawCommandLine = generateCommandLine(nativeFolder).asList(); @@ -317,7 +316,7 @@ public ManagedProcess launch() throws IOException, InterruptedException { if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) { decompressNatives(nativeFolder); - } + } File runDirectory = repository.getRunDirectory(version.getId()); @@ -360,14 +359,13 @@ public void makeLaunchScript(File scriptFile) throws IOException { File nativeFolder = null; if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) { nativeFolder = repository.getNativeDirectory(version.getId()); - } - else { + } else { nativeFolder = new File(options.getNativesDir()); } - + if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) { decompressNatives(nativeFolder); - } + } if (isWindows && !FileUtils.getExtension(scriptFile).equals("bat")) throw new IllegalArgumentException("The extension of " + scriptFile + " is not 'bat' in Windows");