Class JavaConfig

  • All Implemented Interfaces:

    
    public final class JavaConfig
    
                        

    Settings-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.

    • Method Detail

      • 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.java followed by the number representing the Java version

        • value: 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.java followed by the number representing the Java version

        • value: 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:

        true if a viable path has been set.