Server Pack
Base-class for the de.griefed.serverpackcreator.api.ServerPackHandler to ensure we have the most important methods for generating a server pack from a given configuration.
Author
Griefed
Inheritors
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!
Cleans up the server_pack directory by deleting left-over files from modloader installations and version checking.
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 actual files first before then correcting the given ConfigurationModel.
Copies the server.properties into server pack.
Create start-scripts for the generated server pack using the templates the user has defined for their instance of ServerPackCreator in the property de.griefed.serverpackcreator.serverpack.script.template
.
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.
Check whether the given file or directory should be excluded from the server pack.
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.
Download and provide the improved Fabric Server Launcher, if it is available for the given Minecraft and Fabric version.
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 the server pack previously generated. Depending on the property de.griefed.serverpackcreator.serverpack.zip.exclude.enabled
, files will be excluded. To customize the files which will be excluded, see the property de.griefed.serverpackcreator.serverpack.zip.exclude
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.