Configuration Handler
Check any given PackConfig for errors and, if so desired, add them to a passed list of errors, so you may display them in a GUI, CLI or website. The most important method is checkConfiguration and all of its variants which will check your passed configuration model for errors, indicating whether it is safe to use for further operations. Running your model through the checks also ensures that the default script settings are present and set according to your pack's environment.
Author
Griefed
Parameters
Base settings of SPC used just about everywhere.
Meta used for Minecraft and modloader version checks and verification.
Common utilities used all across SPC.
Addons and extensions added by external addons which can add additional checks to a given configuration check.
Constructors
Functions
Check the passed packConfig. If any check returns true
then the server pack will not be created. In order to find out which check failed, the user has to check their serverpackcreator.log in the logs-directory.
Check the passed configuration-file. If any check returns true
then the server pack will not be created. In order to find out which check failed, the user has to check their serverpackcreator.log in the logs-directory.
Check for minecraftinstance.json and profile.json and if either is present, try to obtain the project- and fileIDs as well as the modpack distribution-platform (Modrinth or CurseForge).
Checks the passed String whether it is an existing file. If the passed String is empty, then ServerPackCreator will treat it as the user being fine with the default files and return the corresponding boolean.
Checks whether the passed list of directories which are supposed to be in the modpack directory is empty, or whether all directories in the list exist in the modpack directory. If the user specified a source/file;destination/file
-combination, it is checked whether the specified source-file exists on the host.
Check whether various manifests from various launchers exist and use them to update our ConfigurationModel and pack name.
Checks whether either Forge or Fabric were specified as the modloader.
Check the given Minecraft and modloader versions for the specified modloader.
Check the passed directory for existence and whether it is a directory, rather than a file.
Check whether a server pack for the given destination already exists and get an incrementor based on whether one exists, how many, or none exist. Think if this as the incrementation Windows does when a file of the same name is copied. foo.bar
becomes foo (1).bar
etc.
Check a given ZIP-archives contents. If the ZIP-archive only contains one directory, or if it contains neither the mods nor the config directories, consider it invalid.
Update the script settings and ensure the default keys, with values gathered from the passed PackConfig, are present:
Generate a PackConfig from a modpack-directory, resulting in a basic server pack configuration with default values, for an easy-to-use starting point of a server pack config.
Acquire a list of all files and directories in a ZIP-file.
Acquire a list of all directories in a ZIP-file. The resulting list excludes files.
Acquire a list of directories in the base-directory of a ZIP-file.
Acquire a list of all files in a ZIP-file. The resulting list excludes directories.
Ensures the modloader is normalized to first letter upper case and rest lower case. Basically allows the user to input Forge or Fabric in any combination of upper- and lowercase and ServerPackCreator will still be able to work with the users input.
If the in the configuration specified modpack dir is an existing directory, checks are made for valid configuration of: directories to copy to server pack, if includeServerInstallation is true
path to Java executable/binary, Minecraft version, modloader and modloader version.
Checks the specified ZIP-archive for validity. In order for a modpack ZIP-archive to be considered valid, it needs to contain the mods
and config
folders at minimum. If any of manifest.json
, minecraftinstance.json
or config.json
are available, gather as much information from them as possible.
Convenience method which passes the important fields from an instance of PackConfig to .printConfigurationModel
Prints all passed fields to the console and serverpackcreator.log. Used to show the user the configuration before ServerPackCreator starts the generation of the server pack or, if checks failed, to show the user their last configuration, so they can more easily identify problems with said configuration.
Print all encountered errors to logs.
Sanitize any and all links in a given instance of PackConfig modpack-directory, server-icon path, server-properties path, Java path and copy-directories entries.
Creates a list of suggested directories to include in server pack which is later on written to a new configuration file. The list of directories to include in the server pack which is generated by this method excludes well know directories which would not be needed by a server pack. If you have suggestions to this list, open a feature request issue on GitHub
Update the destination to which the ZIP-archive will the extracted to, based on whether a directory of the same name already exists.
instance.json
config.json
manifest.json
parentDirectory/instance.json
minecraftinstance.json
mmc-pack.json
modrinth.index.json
instance.cfg
Acquire the modpacks name from the JSON previously acquired and stored in the ConfigurationModel.