Class ServerPackFileGatherer

  • All Implemented Interfaces:

    
    public final class ServerPackFileGatherer
    
                        

    Gatherer 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 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.

      • 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.

      • 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.