Class JavaConfig
-
- All Implemented Interfaces:
public final class JavaConfigSettings-group for Java-installations used by ServerPackCreator: the Java for modloader-server installs with validation and system-fallback, the per-version java-paths for script-variables, and the script-autoupdate flag. Extracted from ApiProperties (refactor Phase 1b); ApiProperties remains the facade through which consumers access these values.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringJAVA_FOR_SERVER_INSTALL_KEYpublic final static StringSCRIPT_JAVA_PATHS_PREFIXpublic final static StringSCRIPT_JAVA_AUTOUPDATE_KEYprivate final BooleanfallbackJavaScriptAutoupdateEnabledprivate HashMap<String, String>javaPathsprivate BooleanisJavaScriptAutoupdateEnabledprivate StringjavaPath
-
Constructor Summary
Constructors Constructor Description JavaConfig(PropertyStore store)
-
Method Summary
Modifier and Type Method Description final BooleangetFallbackJavaScriptAutoupdateEnabled()Fallback-value for automatic updates of the SPC_JAVA_SPC script-placeholder. final HashMap<String, String>getJavaPaths()Paths to Java installations available to SPC for automatically updating the script variables of a given server pack configuration. final UnitsetJavaPaths(HashMap<String, String> values)Paths to Java installations available to SPC for automatically updating the script variables of a given server pack configuration. final BooleanisJavaScriptAutoupdateEnabled()Whether to automatically update the SPC_JAVA_SPC-placeholder in the script variables table with a Java path matching the required Java version for the Minecraft server.final UnitsetJavaScriptAutoupdateEnabled(Boolean value)Whether to automatically update the SPC_JAVA_SPC-placeholder in the script variables table with a Java path matching the required Java version for the Minecraft server.final StringgetJavaPath()Java installation used for installing the modloader server during server pack creation. final UnitsetJavaPath(String value)Java installation used for installing the modloader server during server pack creation. final Optional<String>javaPath(Integer javaVersion)Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience. final Optional<String>javaPath(String javaVersion)Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience. final StringacquireJavaPath(String pathToJava)Check the given path to a Java installation for validity and return it, if it is valid. final BooleanjavaAvailable()Whether a viable path to a Java executable or binary has been configured for ServerPackCreator. -
-
Constructor Detail
-
JavaConfig
JavaConfig(PropertyStore store)
-
-
Method Detail
-
getFallbackJavaScriptAutoupdateEnabled
final Boolean getFallbackJavaScriptAutoupdateEnabled()
Fallback-value for automatic updates of the SPC_JAVA_SPC script-placeholder.
-
getJavaPaths
final HashMap<String, String> getJavaPaths()
Paths to Java installations available to SPC for automatically updating the script variables of a given server pack configuration.
key: Java version
value: Path to the Java .exe or binary
If you plan on overwriting this property, make sure to format they key-value-pairs as follows:
key:
de.griefed.serverpackcreator.script.javafollowed by the number representing the Java versionvalue: Valid path to a Java installation corresponding to the number used in the key
-
setJavaPaths
final Unit setJavaPaths(HashMap<String, String> values)
Paths to Java installations available to SPC for automatically updating the script variables of a given server pack configuration.
key: Java version
value: Path to the Java .exe or binary
If you plan on overwriting this property, make sure to format they key-value-pairs as follows:
key:
de.griefed.serverpackcreator.script.javafollowed by the number representing the Java versionvalue: Valid path to a Java installation corresponding to the number used in the key
-
isJavaScriptAutoupdateEnabled
final Boolean isJavaScriptAutoupdateEnabled()
Whether to automatically update the
SPC_JAVA_SPC-placeholder in the script variables table with a Java path matching the required Java version for the Minecraft server.
-
setJavaScriptAutoupdateEnabled
final Unit setJavaScriptAutoupdateEnabled(Boolean value)
Whether to automatically update the
SPC_JAVA_SPC-placeholder in the script variables table with a Java path matching the required Java version for the Minecraft server.
-
getJavaPath
final String getJavaPath()
Java installation used for installing the modloader server during server pack creation.
-
setJavaPath
final Unit setJavaPath(String value)
Java installation used for installing the modloader server during server pack creation.
-
javaPath
final Optional<String> javaPath(Integer javaVersion)
Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience.
- Parameters:
javaVersion- The Java version to acquire the path for.- Returns:
The path to the Java executable/binary, if available.
-
javaPath
final Optional<String> javaPath(String javaVersion)
Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience.
- Parameters:
javaVersion- The Java version to acquire the path for.- Returns:
The path to the Java executable/binary, if available.
-
acquireJavaPath
final String acquireJavaPath(String pathToJava)
Check the given path to a Java installation for validity and return it, if it is valid. If the passed path is a UNIX symlink or Windows lnk, it is resolved, then returned. If the passed path is considered invalid, the system default is acquired and returned.
- Parameters:
pathToJava- The path to check for whether it is a valid Java installation.- Returns:
Returns the path to the Java installation. If user input was incorrect, SPC will try to acquire the path automatically.
-
javaAvailable
final Boolean javaAvailable()
Whether a viable path to a Java executable or binary has been configured for ServerPackCreator.
- Returns:
trueif a viable path has been set.
-
-
-
-