Class ServerPackFileGatherer
-
- All Implemented Interfaces:
public final class ServerPackFileGathererGatherer of all files which make up a server pack: resolves inclusion-specifications to source-destination-pairs, applies in-/exclusion-filters, delegates the mods-directory to the mod-list-compiler, and performs the copy itself. Extracted from ServerPackHandler (refactor Phase 1d); ServerPackHandler remains the facade through which consumers access these operations.
-
-
Constructor Summary
Constructors Constructor Description ServerPackFileGatherer(ModListCompiler modListCompiler)
-
Method Summary
Modifier and Type Method Description final List<File>copyFiles(String modpackDir, ArrayList<InclusionSpecification> inclusions, List<String> clientMods, List<String> whitelist, String minecraftVersion, String destination, String modloader, Boolean overwrite, Function1<File, Boolean> isProtected)Copies all specified directories and mods, excluding clientside-only mods, from the modpack directory into the server pack directory. final List<File>copyFiles(String modpackDir, ArrayList<InclusionSpecification> inclusions, List<String> clientMods, List<String> whitelist, String minecraftVersion, String destination, String modloader, Boolean overwrite)Copies all specified directories and mods, excluding clientside-only mods, from the modpack directory into the server pack directory. final List<ServerPackFile>getServerFiles(InclusionSpecification inclusion, String modpackDir, String destination, List<Regex> exclusions, List<String> clientMods, List<String> modWhitelist, String minecraftVersion, String modloader)Resolve one inclusion into the concrete files to copy, applying its filters and destination. final List<ServerPackFile>getExplicitFiles(String source, String destination, String modpackDir, String serverPackDestination)Gather a list of all files from an explicit source;destination-combination. final List<ServerPackFile>getSaveFiles(String clientDir, String directory, String destination)Recursively acquire all files and directories inside the given save-directory as a list of ServerPackFile. final List<ServerPackFile>getDirectoryFiles(String source, String destination)Recursively acquire all files and directories inside the given directory as a list of ServerPackFile. final BooleanexcludeFileOrDirectory(String modpackDir, File fileToCheckFor, List<Regex> exclusions)Check whether the given file or directory should be excluded from the server pack. final UnitregexWalk(File source, String destination, Regex regex, List<ServerPackFile> serverPackFiles)Walk through the specified directory and add a ServerPackFile for every file/folder which matches the given regex. -
-
Constructor Detail
-
ServerPackFileGatherer
ServerPackFileGatherer(ModListCompiler modListCompiler)
-
-
Method Detail
-
copyFiles
@JvmOverloads() final List<File> copyFiles(String modpackDir, ArrayList<InclusionSpecification> inclusions, List<String> clientMods, List<String> whitelist, String minecraftVersion, String destination, String modloader, Boolean overwrite, Function1<File, Boolean> isProtected)
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.
-
copyFiles
@JvmOverloads() final List<File> copyFiles(String modpackDir, ArrayList<InclusionSpecification> inclusions, List<String> clientMods, List<String> whitelist, String minecraftVersion, String destination, String modloader, Boolean overwrite)
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.
-
getServerFiles
final List<ServerPackFile> getServerFiles(InclusionSpecification inclusion, String modpackDir, String destination, List<Regex> exclusions, List<String> clientMods, List<String> modWhitelist, String minecraftVersion, String modloader)
Resolve one inclusion into the concrete files to copy, applying its filters and destination.
-
getExplicitFiles
final List<ServerPackFile> getExplicitFiles(String source, String destination, String modpackDir, String serverPackDestination)
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.
-
getSaveFiles
final List<ServerPackFile> getSaveFiles(String clientDir, String directory, String destination)
Recursively acquire all files and directories inside the given save-directory as a list of ServerPackFile.
clientDir — Target directory in the server pack. Usually the name of the world. destination — The destination of the server pack. Returns list of ServerPackFile which will be included in the server pack.
-
getDirectoryFiles
final List<ServerPackFile> getDirectoryFiles(String source, String destination)
Recursively acquire all files and directories inside the given directory as a list of ServerPackFile.
destination — The server pack-directory. Returns list of files and folders of the server pack.
-
excludeFileOrDirectory
final Boolean excludeFileOrDirectory(String modpackDir, File fileToCheckFor, List<Regex> exclusions)
Check whether the given file or directory should be excluded from the server pack.
modpackDir — The directory where the modpack resides in. Used to filter out any unwanted directories using the property
de.griefed.serverpackcreator.configuration.directories.shouldexclude. exclusions — Files or directories determined by ServerPackCreator to be excluded from the server pack.
-
regexWalk
final Unit regexWalk(File source, String destination, Regex regex, List<ServerPackFile> serverPackFiles)
Walk through the specified directory and add a ServerPackFile for every file/folder which matches the given regex.
source — The source-directory to walk through and perform regex-matches in. destination — The destination-directory where a matched file should be copied to, usually the server pack directory. regex — Regex with which to perform matches against files in the source-directory. serverPackFiles — List of files to copy to the server pack to which any matched file will be added to.
-
-
-
-