Class PackConfig

  • All Implemented Interfaces:

    
    public class PackConfig
    
                        

    A PackConfig contains the settings required to create a server pack. A configuration model usually consists of:

    • Modpack directory

    • Minecraft version

    • Modloader

    • Modloader version

    • Java args for the start scripts

    • Files and directories to copy to the server pack

    • Whether to pre-install the modloader server

    • Whether to include a server-icon

    • Whether to include a server.properties

    • Whether to create a ZIP-archive

    Author:

    Griefed

    • Constructor Detail

      • PackConfig

        PackConfig()
      • PackConfig

        PackConfig(List<String> clientMods, List<String> whitelist, List<InclusionSpecification> copyDirs, String modpackDir, String minecraftVersion, String modLoader, String modLoaderVersion, String javaArgs, String serverPackSuffix, String serverIconPath, String serverPropertiesPath, Boolean includeServerIcon, Boolean includeServerProperties, Boolean includeZipCreation, HashMap<String, String> scriptSettings, HashMap<String, ArrayList<CommentedConfig>> pluginsConfigs)

        Construct a new configuration model with custom values.

        Parameters:
        clientMods - List of clientside mods to exclude from the server pack.
        whitelist - List of mods to include if present, regardless whether a match was found through clientMods
        copyDirs - List of directories and/or files to include in the server pack.
        modpackDir - The path to the modpack.
        minecraftVersion - The Minecraft version the modpack uses.
        modLoader - The modloader the modpack uses.
        modLoaderVersion - The modloader version the modpack uses.
        javaArgs - JVM flags to create the start scripts with.
        serverPackSuffix - Suffix to create the server pack with.
        serverIconPath - Path to the icon to use in the server pack.
        serverPropertiesPath - Path to the server.properties to create the server pack with.
        includeServerIcon - Whether to include the server-icon.png in the server pack.
        includeServerProperties - Whether to include the server.properties in the server pack.
        includeZipCreation - Whether to create a ZIP-archive of the server pack.
        scriptSettings - Map containing key-value pairs to be used in start script creation.
        pluginsConfigs - Configuration for any and all plugins used by this configuration.
      • PackConfig

        PackConfig(File configFile)

        Create a new configuration model from a config file.

        Parameters:
        configFile - Configuration file to load.
    • Method Detail

      • getForge

         final Regex getForge()

        Loader-name matcher for Forge, from the single source of truth in SupportedModloaders.

      • getNeoForge

         final Regex getNeoForge()

        Loader-name matcher for NeoForge. Tested before forge, whose pattern also matches neoforge.

      • getLegacyFabric

         final Regex getLegacyFabric()

        Loader-name matcher for LegacyFabric. Tested before fabric, whose pattern would otherwise swallow it.

      • getWhitespace

         final Regex getWhitespace()

        Matches a string that is only whitespace, so a blank-but-not-empty config value can be rejected.

      • getClientMods

         final ArrayList<String> getClientMods()

        Mods to exclude from the server pack because they are clientside — filenames or name-fragments matched against the modpack's mods directory. modsWhitelist wins over anything matched here.

      • getModpackDir

         final String getModpackDir()

        Path to the modpack this server pack is generated from.

      • getMinecraftVersion

         final String getMinecraftVersion()

        The Minecraft version the modpack targets, which drives loader-version validity and the required Java.

      • setMinecraftVersion

         final Unit setMinecraftVersion(String value)

        The Minecraft version the modpack targets, which drives loader-version validity and the required Java.

      • getJavaArgs

         final String getJavaArgs()

        JVM arguments written into the generated start scripts.

      • setJavaArgs

         final Unit setJavaArgs(String value)

        JVM arguments written into the generated start scripts.

      • getServerPackSuffix

         final String getServerPackSuffix()

        Appended to the server pack's directory name, so variants of one modpack can coexist.

      • setServerPackSuffix

         final Unit setServerPackSuffix(String value)

        Appended to the server pack's directory name, so variants of one modpack can coexist.

      • getServerIconPath

         final String getServerIconPath()

        Path to a server icon to include, or empty to use the shipped default.

      • getModloader

         final String getModloader()

        The modloader, always stored in SPC's canonical spelling (Forge, NeoForge, Fabric, Quilt, LegacyFabric).

        Landmine: the setter silently ignores an unrecognised value, leaving the previous one in place — a typo does not fail, it does nothing. Check order matters for the same reason: neoforge also matches Forge's pattern and legacyfabric matches Fabric's, so the specific names are tested first.

      • setModloader

         final Unit setModloader(String newModLoader)

        The modloader, always stored in SPC's canonical spelling (Forge, NeoForge, Fabric, Quilt, LegacyFabric).

        Landmine: the setter silently ignores an unrecognised value, leaving the previous one in place — a typo does not fail, it does nothing. Check order matters for the same reason: neoforge also matches Forge's pattern and legacyfabric matches Fabric's, so the specific names are tested first.

      • isServerIconInclusionDesired

         final Boolean isServerIconInclusionDesired()

        Whether the server icon is copied into the pack. Keep the @get:JsonProperty rule in mind for web entities.

      • isZipCreationDesired

         final Boolean isZipCreationDesired()

        Whether the finished pack is also zipped, which is what a user downloads from the web frontend.

      • setZipCreationDesired

         final Unit setZipCreationDesired(Boolean value)

        Whether the finished pack is also zipped, which is what a user downloads from the web frontend.

      • getModpackJson

         final JsonNode getModpackJson()

        The modpack's own manifest, when generation was driven from one (CurseForge/Modrinth export).

      • setModpackJson

         final Unit setModpackJson(JsonNode value)

        The modpack's own manifest, when generation was driven from one (CurseForge/Modrinth export).

      • getConfigVersion

         final String getConfigVersion()

        Version of the config format this instance was read from, used to migrate older .conf files.

      • setConfigVersion

         final Unit setConfigVersion(String value)

        Version of the config format this instance was read from, used to migrate older .conf files.

      • getCustomDestination

         final Optional<File> getCustomDestination()

        Where to write the server pack instead of SPC's server-packs directory, when a caller overrides it.

      • getProjectID

         String getProjectID()

        Platform project id when the modpack came from Modrinth or CurseForge, else null.

      • setProjectID

         Unit setProjectID(String value)

        Platform project id when the modpack came from Modrinth or CurseForge, else null.

      • getVersionID

         String getVersionID()

        Platform version/file id the modpack was resolved from, else null.

      • setVersionID

         Unit setVersionID(String value)

        Platform version/file id the modpack was resolved from, else null.

      • getSource

         ModpackSource getSource()

        Where the modpack came from — a directory, a zip, or a platform link — which decides how it is unpacked.

      • setSource

         Unit setSource(ModpackSource value)

        Where the modpack came from — a directory, a zip, or a platform link — which decides how it is unpacked.

      • getName

         String getName()

        Display name for the pack, used for the generated directory and in the web frontend.

      • setName

         Unit setName(String value)

        Display name for the pack, used for the generated directory and in the web frontend.

      • save

        @Deprecated(message = "Resolves ApiProperties through the ApiWrapper-singleton.", replaceWith = @ReplaceWith(expression = "save(destination, apiProperties)")) final PackConfig save(File destination)

        Save this configuration to disk, resolving the ApiProperties through the global ApiWrapper-singleton. Prefer the explicit save overload which receives the ApiProperties directly, avoiding the hidden service-locator dependency.

      • getPluginConfigs

         final ArrayList<CommentedConfig> getPluginConfigs(String pluginId)

        Configuration for one plugin, creating an empty list on first ask so an extension can always read and append without null-checking. That side effect is why this is a function rather than a map access.

      • toString

         String toString()

        Every field of this configuration, for logging a generation run and for debugging a rejected config.