Server Pack Handler
Everything revolving around creating a server pack. The intended workflow is to create a PackConfig and run it through any of the available de.griefed.serverpackcreator.api.config.ConfigurationHandler.checkConfiguration-variants, and then call run with the previously checked configuration model. You may run with an unchecked configuration model, but no guarantees or promises, yes not even support, is given for running a model without checking it first.
This class also gives you access to the methods which are responsible for creating the server pack, in case you want to do things manually.
The methods in question are:
getImprovedFabricLauncher if Fabric is the chosen Modloader
If you want to execute extensions, see
Author
Griefed
Parameters
Base settings of ServerPackCreator needed for server pack generation, such as access to the directories, script templates and so on.
Meta for modloader and version specific checks and information gathering, such as modloader installer downloads.
Common utilities used across ServerPackCreator.
Any addons which a user may want to execute during the generation of a server pack.
In case a user enabled automatic sideness detection, this will exclude clientside-only mods from a server pack.
Constructors
Properties
Functions
Deletes all files, directories and ZIP-archives of previously generated server packs to ensure newly generated server pack is as clean as possible. This will completely empty the server pack directory, so use with caution!
Copies all specified directories and mods, excluding clientside-only mods, from the modpack directory into the server pack directory. If a source/file;destination/file
-combination is provided, the specified source-file is copied to the specified destination-file. One of the reasons as to why it is recommended to run a given ConfigurationModel through the ConfigurationHandler first, is because the ConfigurationHandler will resolve links to their files first before then correcting the given ConfigurationModel.
Copies the server.properties into server pack.
Go through the mods in the modpack and exclude any of the user-specified clientside-only mods according to the filter method set in the serverpackcreator.properties. For available filters, see ExclusionFilter.
Exclude every automatically discovered clientside-only mod from the list of mods in the modpack.
Recursively acquire all files and directories inside the given directory as a list of ServerPackFile.
Gather a list of all files from an explicit source;destination-combination. If the source is a file, a singular ServerPackFile is returned. If the source is a directory, then all files in said directory are returned.
Download and provide the improved Fabric Server Launcher, if it is available for the given Minecraft and Fabric version.
Generates a list of all mods to include in the server pack. If the user specified clientside-mods to exclude, and/or if the automatic exclusion of clientside-only mods is active, they will be excluded, too.
Recursively acquire all files and directories inside the given save-directory as a list of ServerPackFile.
Acquire the destination directory in which the server pack will be generated. The directory in which the server pack will be created has all its spaces replaces with underscores, so Survive Create Prosper 4 - 5.0.1
would become Survive_Create_Prosper_4_-_5.0.1
Even though it is the year 2022, spaces in paths can and do still cause trouble. Such as for Powershell scripts. Powershell throws a complete fit if the path contains spaces....so, we remove them. Better safe than sorry.
Cleans up the server_pack directory by deleting left-over files from modloader installations and version checking.
Delete files and folders from previous installations to prevent errors during server installation due to already existing files.
Walk through the specified directory and add a ServerPackFile for every file/folder which matches the given regex.
Replace placeholders for script settings in the given content with their respective values, both provided via the HashMap scriptSettings.
Create a server pack from a given instance of PackConfig.
Check whether the installer for the given combination of Minecraft version, modloader and modloader version is available/reachable.
Creates a ZIP-archive of specified directory. Depending on the property de.griefed.serverpackcreator.serverpack.zip.exclude.enabled
, files will be excluded. To customize the files which will be excluded, the property de.griefed.serverpackcreator.serverpack.zip.exclude
must be configured accordingly. The created ZIP-archive will be stored alongside the specified destination, with _server_pack.zip
appended to its name.