Class PackConfig
-
- All Implemented Interfaces:
public class PackConfigA 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
Griefed
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPackConfig.CompanionThe start-script placeholder defaults every new configuration begins with.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description 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. PackConfig(File configFile)Create a new configuration model from a config file.
-
Method Summary
Modifier and Type Method Description final RegexgetForge()Loader-name matcher for Forge, from the single source of truth in SupportedModloaders.final RegexgetNeoForge()Loader-name matcher for NeoForge. final RegexgetFabric()Loader-name matcher for Fabric. final RegexgetQuilt()Loader-name matcher for Quilt. final RegexgetLegacyFabric()Loader-name matcher for LegacyFabric. final RegexgetWhitespace()Matches a string that is only whitespace, so a blank-but-not-empty config value can be rejected. final ArrayList<String>getClientMods()Mods to exclude from the server pack because they are clientside — filenames or name-fragments matched against the modpack's modsdirectory.final ArrayList<String>getModsWhitelist()Mods to keep even when clientMods matches them — the escape hatch for an over-broad exclusion. final ArrayList<InclusionSpecification>getInclusions()What to copy into the server pack: per-entry source, destination and optional filters. final HashMap<String, String>getScriptSettings()Values substituted into the generated start scripts, keyed by their SPC_..._SPCplaceholder.final HashMap<String, ArrayList<CommentedConfig>>getPluginsConfigs()Per-plugin configuration, keyed by plugin id and handed to whichever extension declared it. final StringgetModpackDir()Path to the modpack this server pack is generated from. final UnitsetModpackDir(String value)Path to the modpack this server pack is generated from. final StringgetMinecraftVersion()The Minecraft version the modpack targets, which drives loader-version validity and the required Java. final UnitsetMinecraftVersion(String value)The Minecraft version the modpack targets, which drives loader-version validity and the required Java. final StringgetModloaderVersion()The modloader version — meaningful only together with minecraftVersion and modloader. final UnitsetModloaderVersion(String value)The modloader version — meaningful only together with minecraftVersion and modloader. final StringgetJavaArgs()JVM arguments written into the generated start scripts. final UnitsetJavaArgs(String value)JVM arguments written into the generated start scripts. final StringgetServerPackSuffix()Appended to the server pack's directory name, so variants of one modpack can coexist. final UnitsetServerPackSuffix(String value)Appended to the server pack's directory name, so variants of one modpack can coexist. final StringgetServerIconPath()Path to a server icon to include, or empty to use the shipped default. final UnitsetServerIconPath(String value)Path to a server icon to include, or empty to use the shipped default. final StringgetServerPropertiesPath()Path to a server.propertiesto include, or empty to use the shipped default.final UnitsetServerPropertiesPath(String value)Path to a server.propertiesto include, or empty to use the shipped default.final StringgetModloader()The modloader, always stored in SPC's canonical spelling ( Forge,NeoForge,Fabric,Quilt,LegacyFabric).final UnitsetModloader(String newModLoader)The modloader, always stored in SPC's canonical spelling ( Forge,NeoForge,Fabric,Quilt,LegacyFabric).final BooleanisServerIconInclusionDesired()Whether the server icon is copied into the pack. final UnitsetServerIconInclusionDesired(Boolean value)Whether the server icon is copied into the pack. final BooleanisServerPropertiesInclusionDesired()Whether server.propertiesis copied into the pack.final UnitsetServerPropertiesInclusionDesired(Boolean value)Whether server.propertiesis copied into the pack.final BooleanisZipCreationDesired()Whether the finished pack is also zipped, which is what a user downloads from the web frontend. final UnitsetZipCreationDesired(Boolean value)Whether the finished pack is also zipped, which is what a user downloads from the web frontend. final JsonNodegetModpackJson()The modpack's own manifest, when generation was driven from one (CurseForge/Modrinth export). final UnitsetModpackJson(JsonNode value)The modpack's own manifest, when generation was driven from one (CurseForge/Modrinth export). final StringgetConfigVersion()Version of the config format this instance was read from, used to migrate older .conffiles.final UnitsetConfigVersion(String value)Version of the config format this instance was read from, used to migrate older .conffiles.final Optional<File>getCustomDestination()Where to write the server pack instead of SPC's server-packs directory, when a caller overrides it. final UnitsetCustomDestination(Optional<File> value)Where to write the server pack instead of SPC's server-packs directory, when a caller overrides it. StringgetProjectID()Platform project id when the modpack came from Modrinth or CurseForge, else null.UnitsetProjectID(String value)Platform project id when the modpack came from Modrinth or CurseForge, else null.StringgetVersionID()Platform version/file id the modpack was resolved from, else null.UnitsetVersionID(String value)Platform version/file id the modpack was resolved from, else null.ModpackSourcegetSource()Where the modpack came from — a directory, a zip, or a platform link — which decides how it is unpacked. UnitsetSource(ModpackSource value)Where the modpack came from — a directory, a zip, or a platform link — which decides how it is unpacked. StringgetName()Display name for the pack, used for the generated directory and in the web frontend. UnitsetName(String value)Display name for the pack, used for the generated directory and in the web frontend. final PackConfigsave(File destination)Save this configuration to disk, resolving the ApiProperties through the global ApiWrapper-singleton. final PackConfigsave(File destination, ApiProperties apiProperties)Save this configuration to disk, using the given apiProperties for the configuration version-stamp. final UnitsetPluginsConfigs(HashMap<String, ArrayList<CommentedConfig>> pluginConfigs)Replace all per-plugin configuration wholesale, discarding whatever was set before. 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. final UnitsetClientMods(List<String> newClientMods)Replace the clientside-exclusion list wholesale. final UnitsetModsWhitelist(List<String> newModsWhitelist)Replace the whitelist wholesale — entries here survive a clientMods match. final UnitsetInclusions(ArrayList<InclusionSpecification> newCopyDirs)Replace the inclusion specifications wholesale. final UnitsetScriptSettings(HashMap<String, String> settings)Replace the start-script placeholder values wholesale. StringtoString()Every field of this configuration, for logging a generation run and for debugging a rejected config. -
-
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 clientModscopyDirs- 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
modsdirectory. modsWhitelist wins over anything matched here.
-
getModsWhitelist
final ArrayList<String> getModsWhitelist()
Mods to keep even when clientMods matches them — the escape hatch for an over-broad exclusion.
-
getInclusions
final ArrayList<InclusionSpecification> getInclusions()
What to copy into the server pack: per-entry source, destination and optional filters.
-
getScriptSettings
final HashMap<String, String> getScriptSettings()
Values substituted into the generated start scripts, keyed by their
SPC_..._SPCplaceholder.
-
getPluginsConfigs
final HashMap<String, ArrayList<CommentedConfig>> getPluginsConfigs()
Per-plugin configuration, keyed by plugin id and handed to whichever extension declared it.
-
getModpackDir
final String getModpackDir()
Path to the modpack this server pack is generated from.
-
setModpackDir
final Unit setModpackDir(String value)
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.
-
getModloaderVersion
final String getModloaderVersion()
The modloader version — meaningful only together with minecraftVersion and modloader.
-
setModloaderVersion
final Unit setModloaderVersion(String value)
The modloader version — meaningful only together with minecraftVersion and modloader.
-
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.
-
setServerIconPath
final Unit setServerIconPath(String value)
Path to a server icon to include, or empty to use the shipped default.
-
getServerPropertiesPath
final String getServerPropertiesPath()
Path to a
server.propertiesto include, or empty to use the shipped default.
-
setServerPropertiesPath
final Unit setServerPropertiesPath(String value)
Path to a
server.propertiesto 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:
neoforgealso matches Forge's pattern andlegacyfabricmatches 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:
neoforgealso matches Forge's pattern andlegacyfabricmatches 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:JsonPropertyrule in mind for web entities.
-
setServerIconInclusionDesired
final Unit setServerIconInclusionDesired(Boolean value)
Whether the server icon is copied into the pack. Keep the
@get:JsonPropertyrule in mind for web entities.
-
isServerPropertiesInclusionDesired
final Boolean isServerPropertiesInclusionDesired()
Whether
server.propertiesis copied into the pack.
-
setServerPropertiesInclusionDesired
final Unit setServerPropertiesInclusionDesired(Boolean value)
Whether
server.propertiesis copied into the pack.
-
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
.conffiles.
-
setConfigVersion
final Unit setConfigVersion(String value)
Version of the config format this instance was read from, used to migrate older
.conffiles.
-
getCustomDestination
final Optional<File> getCustomDestination()
Where to write the server pack instead of SPC's server-packs directory, when a caller overrides it.
-
setCustomDestination
final Unit setCustomDestination(Optional<File> value)
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.
-
save
final PackConfig save(File destination, ApiProperties apiProperties)
Save this configuration to disk, using the given apiProperties for the configuration version-stamp.
-
setPluginsConfigs
final Unit setPluginsConfigs(HashMap<String, ArrayList<CommentedConfig>> pluginConfigs)
Replace all per-plugin configuration wholesale, discarding whatever was set before.
-
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.
-
setClientMods
final Unit setClientMods(List<String> newClientMods)
Replace the clientside-exclusion list wholesale.
-
setModsWhitelist
final Unit setModsWhitelist(List<String> newModsWhitelist)
Replace the whitelist wholesale — entries here survive a clientMods match.
-
setInclusions
final Unit setInclusions(ArrayList<InclusionSpecification> newCopyDirs)
Replace the inclusion specifications wholesale.
-
setScriptSettings
final Unit setScriptSettings(HashMap<String, String> settings)
Replace the start-script placeholder values wholesale.
-
-
-
-