@Component
public final class ConfigUtilities
extends java.lang.Object
| Constructor and Description |
|---|
ConfigUtilities(Utilities injectedUtilities,
ApplicationProperties injectedApplicationProperties,
com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkCurseForgeJsonForFabric(com.fasterxml.jackson.databind.JsonNode modpackJson)
Deprecated.
Regular checks in
updateConfigModelFromCurseManifest(ConfigurationModel, File) detect Fabric and the
version. Iterating through the mods list is no longer necessary. |
java.util.List<java.lang.String> |
getAllFilesAndDirectoriesInModpackZip(net.lingala.zip4j.ZipFile zipFile)
Acquire a list of all files and directories in a ZIP-file.
|
java.util.List<java.lang.String> |
getDirectoriesInModpackZip(net.lingala.zip4j.ZipFile zipFile)
Acquire a list of all directories in a ZIP-file.
|
java.util.List<java.lang.String> |
getDirectoriesInModpackZipBaseDirectory(net.lingala.zip4j.ZipFile zipFile)
Acquire a list of directories in the base-directory of a ZIP-file.
|
java.util.List<java.lang.String> |
getFilesInModpackZip(net.lingala.zip4j.ZipFile zipFile)
Acquire a list of all files in a ZIP-file.
|
java.lang.String |
getModLoaderCase(java.lang.String modloader)
Ensures the modloader is normalized to first letter upper case and rest lower case.
|
void |
printConfigurationModel(ConfigurationModel configurationModel)
Convenience method which passes the important fields from an instance of
ConfigurationModel to
printConfigurationModel(String, List, List, boolean, String, String, String, String,
boolean, boolean, boolean, String, String, String, String) |
void |
printConfigurationModel(java.lang.String modpackDirectory,
java.util.List<java.lang.String> clientsideMods,
java.util.List<java.lang.String> copyDirectories,
boolean installServer,
java.lang.String javaInstallPath,
java.lang.String minecraftVer,
java.lang.String modloader,
java.lang.String modloaderVersion,
boolean includeIcon,
boolean includeProperties,
boolean includeZip,
java.lang.String javaArgs,
java.lang.String serverPackSuffix,
java.lang.String serverIconPath,
java.lang.String serverPropertiesPath)
Prints all passed fields to the console and serverpackcreator.log.
|
java.util.List<java.lang.String> |
suggestCopyDirs(java.lang.String modpackDir)
Creates a list of suggested directories to include in server pack which is later on written to
a new configuration file.
|
void |
updateConfigModelFromATLauncherInstance(ConfigurationModel configurationModel,
java.io.File manifest)
instance.json |
void |
updateConfigModelFromConfigJson(ConfigurationModel configurationModel,
java.io.File config)
config.json |
void |
updateConfigModelFromCurseManifest(ConfigurationModel configurationModel,
java.io.File manifest)
manifest.json |
void |
updateConfigModelFromMinecraftInstance(ConfigurationModel configurationModel,
java.io.File minecraftInstance)
minecraftinstance.json |
void |
updateConfigModelFromMMCPack(ConfigurationModel configurationModel,
java.io.File mmcPack)
mmc-pack.json |
void |
updateConfigModelFromModrinthManifest(ConfigurationModel configurationModel,
java.io.File manifest)
modrinth.index.json |
java.lang.String |
updateDestinationFromInstanceCfg(java.io.File instanceCfg)
instance.cfg |
boolean |
writeConfigToFile(ConfigurationModel configurationModel,
java.io.File fileName)
Convenience method to write a new configuration file with the
ConfigurationModel passed
to it. |
boolean |
writeConfigToFile(java.lang.String modpackDir,
java.util.List<java.lang.String> clientMods,
java.util.List<java.lang.String> copyDirs,
java.lang.String serverIconPath,
java.lang.String serverPropertiesPath,
boolean includeServer,
java.lang.String javaPath,
java.lang.String minecraftVersion,
java.lang.String modLoader,
java.lang.String modLoaderVersion,
boolean includeIcon,
boolean includeProperties,
boolean includeZip,
java.lang.String javaArgs,
java.lang.String serverPackSuffix,
java.io.File fileName)
Writes a new configuration file with the parameters passed to it.
|
@Autowired public ConfigUtilities(Utilities injectedUtilities, ApplicationProperties injectedApplicationProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
public java.lang.String getModLoaderCase(java.lang.String modloader)
modloader - The String to check for case-insensitive cases of either Forge or Fabric.public boolean writeConfigToFile(ConfigurationModel configurationModel, java.io.File fileName)
ConfigurationModel passed
to it. If the given file already exists, it is replaced.configurationModel - Instance of ConfigurationModel to write to a file.fileName - The file to write to.public boolean writeConfigToFile(java.lang.String modpackDir,
java.util.List<java.lang.String> clientMods,
java.util.List<java.lang.String> copyDirs,
java.lang.String serverIconPath,
java.lang.String serverPropertiesPath,
boolean includeServer,
java.lang.String javaPath,
java.lang.String minecraftVersion,
java.lang.String modLoader,
java.lang.String modLoaderVersion,
boolean includeIcon,
boolean includeProperties,
boolean includeZip,
java.lang.String javaArgs,
java.lang.String serverPackSuffix,
java.io.File fileName)
modpackDir - The path to the modpack.clientMods - List of clientside-only mods.copyDirs - List of directories to include in server pack.serverIconPath - The path to the custom server-icon.png to include in the server
pack.serverPropertiesPath - The path to the custom server.properties to include in the server
pack.includeServer - Whether the modloader server software should be installed.javaPath - Path to the java executable/binary.minecraftVersion - Minecraft version used by the modpack and server pack.modLoader - Modloader used by the modpack and server pack. Ether Forge or
Fabric.modLoaderVersion - Modloader version used by the modpack and server pack.includeIcon - Whether to include a server-icon in the server pack.includeProperties - Whether to include a properties file in the server pack.includeZip - Whether to create a ZIP-archive of the server pack, excluding
Mojang's Minecraft server JAR.javaArgs - Java arguments to write the start-scripts with.serverPackSuffix - Suffix to append to the server pack to be generated.fileName - The name under which to write the new configuration file.public void printConfigurationModel(ConfigurationModel configurationModel)
ConfigurationModel to
printConfigurationModel(String, List, List, boolean, String, String, String, String,
boolean, boolean, boolean, String, String, String, String)configurationModel - Instance of ConfigurationModel to print to console and logs.public void printConfigurationModel(java.lang.String modpackDirectory,
java.util.List<java.lang.String> clientsideMods,
java.util.List<java.lang.String> copyDirectories,
boolean installServer,
java.lang.String javaInstallPath,
java.lang.String minecraftVer,
java.lang.String modloader,
java.lang.String modloaderVersion,
boolean includeIcon,
boolean includeProperties,
boolean includeZip,
java.lang.String javaArgs,
java.lang.String serverPackSuffix,
java.lang.String serverIconPath,
java.lang.String serverPropertiesPath)
modpackDirectory - The used modpackDir field either from a configuration file or from
configuration setup.clientsideMods - List of clientside-only mods to exclude from the server pack...copyDirectories - List of directories in the modpack which are to be included in the
server pack.installServer - Whether to install the modloader server in the server pack.javaInstallPath - Path to the Java executable/binary needed for installing the
modloader server in the server pack.minecraftVer - The Minecraft version the modpack uses.modloader - The modloader the modpack uses.modloaderVersion - The version of the modloader the modpack uses.includeIcon - Whether to include the server-icon.png in the server pack.includeProperties - Whether to include the server.properties in the server pack.includeZip - Whether to create a zip-archive of the server pack, excluding the
Minecraft server JAR according to Mojang's TOS and EULA.javaArgs - Java arguments to write the start-scripts with.serverPackSuffix - Suffix to append to name of the server pack to be generated.serverIconPath - The path to the custom server-icon.png to be used in the server
pack.serverPropertiesPath - The path to the custom server.properties to be used in the server
pack.public void updateConfigModelFromATLauncherInstance(ConfigurationModel configurationModel, java.io.File manifest) throws java.io.IOException
instance.json
Update the given ConfigurationModel with values gathered from a ATLauncher manifest.
configurationModel - The model to update.manifest - The manifest file.java.io.IOException - when the instance.json-file could not be parsed.public void updateConfigModelFromModrinthManifest(ConfigurationModel configurationModel, java.io.File manifest) throws java.io.IOException
modrinth.index.json
Update the given ConfigurationModel with values gathered from a Modrinth
modrinth.index.json-manifest.
configurationModel - The model to update.manifest - The manifest file.java.io.IOException - when the modrinth.index.json-file could not be parsed.public void updateConfigModelFromCurseManifest(ConfigurationModel configurationModel, java.io.File manifest) throws java.io.IOException
manifest.json
Update the given ConfigurationModel with values gathered from the downloaded CurseForge modpack. A manifest.json-file is usually created when a modpack is exported through launchers like Overwolf's CurseForge or GDLauncher.
configurationModel - An instance containing a configuration for a modpack from which to
create a server pack.manifest - File. The CurseForge manifest.json-file of the modpack to read.java.io.IOException - when the manifest.json-file could not be parsed.public void updateConfigModelFromMinecraftInstance(ConfigurationModel configurationModel, java.io.File minecraftInstance) throws java.io.IOException
minecraftinstance.json
Update the given ConfigurationModel with values gathered from the minecraftinstance.json of the modpack. A minecraftinstance.json is usually created by Overwolf's CurseForge launcher.
configurationModel - An instance containing a configuration for a modpack from which to
create a server pack.minecraftInstance - File. The minecraftinstance.json-file of the modpack to read.java.io.IOException - when the minecraftinstance.json-file could not be parsed.public void updateConfigModelFromConfigJson(ConfigurationModel configurationModel, java.io.File config) throws java.io.IOException
config.json
Update the given ConfigurationModel with values gathered from the modpacks config.json. A config.json is usually created by GDLauncher.
configurationModel - An instance containing a configuration for a modpack from which to
create a server pack.config - The config.json-file of the modpack to read.java.io.IOException - when the config.json-file could not be parsed.public void updateConfigModelFromMMCPack(ConfigurationModel configurationModel, java.io.File mmcPack) throws java.io.IOException
mmc-pack.json
Update the given ConfigurationModel with values gathered from the modpacks mmc-pack.json. A mmc-pack.json is usually created by the MultiMC launcher.
configurationModel - An instance containing a configuration for a modpack from which to
create a server pack.mmcPack - The config.json-file of the modpack to read.java.io.IOException - when the mmc-pack.json-file could not be parsed.public java.lang.String updateDestinationFromInstanceCfg(java.io.File instanceCfg)
throws java.io.IOException
instance.cfg
Acquire the name of the modpack/instance of a MultiMC modpack from the modpacks instance.cfg, which is usually created by the MultiMC launcher.
instanceCfg - The config.json-file of the modpack to read.java.io.IOException - when the file could not be found or the properties not be loaded from the
file.public java.util.List<java.lang.String> suggestCopyDirs(java.lang.String modpackDir)
modpackDir - The directory for which to gather a list of directories to copy to the server
pack.@Deprecated public boolean checkCurseForgeJsonForFabric(com.fasterxml.jackson.databind.JsonNode modpackJson)
updateConfigModelFromCurseManifest(ConfigurationModel, File) detect Fabric and the
version. Iterating through the mods list is no longer necessary.modLoaders in the manifest specifies Fabric, use that to
set the modloader and its version.modpackJson - JSonNode. JsonNode containing all information about the CurseForge modpack.public java.util.List<java.lang.String> getDirectoriesInModpackZipBaseDirectory(net.lingala.zip4j.ZipFile zipFile)
throws java.lang.IllegalArgumentException,
java.nio.file.FileSystemAlreadyExistsException,
java.nio.file.ProviderNotFoundException,
java.io.IOException,
java.lang.SecurityException
zipFile - The ZIP-archive to get the list of files from.java.lang.IllegalArgumentException - if the pre-conditions for the uri parameter are not
met, or the env parameter does not contain properties
required by the provider, or a property value is
invalid.java.nio.file.FileSystemAlreadyExistsException - if the file system has already been created.java.nio.file.ProviderNotFoundException - if a provider supporting the URI scheme is not
installed.java.io.IOException - if an I/O error occurs creating the file system.java.lang.SecurityException - if a security manager is installed, and it denies an
unspecified permission required by the file system
provider implementation.public java.util.List<java.lang.String> getFilesInModpackZip(net.lingala.zip4j.ZipFile zipFile)
throws java.lang.IllegalArgumentException,
java.nio.file.FileSystemAlreadyExistsException,
java.nio.file.ProviderNotFoundException,
java.io.IOException,
java.lang.SecurityException
zipFile - The ZIP-archive to get the list of files from.java.lang.IllegalArgumentException - if the pre-conditions for the uri parameter are not
met, or the env parameter does not contain properties
required by the provider, or a property value is
invalid.java.nio.file.FileSystemAlreadyExistsException - if the file system has already been created.java.nio.file.ProviderNotFoundException - if a provider supporting the URI scheme is not
installed.java.io.IOException - if an I/O error occurs creating the file system.java.lang.SecurityException - if a security manager is installed, and it denies an
unspecified permission required by the file system
provider implementation.public java.util.List<java.lang.String> getDirectoriesInModpackZip(net.lingala.zip4j.ZipFile zipFile)
throws java.lang.IllegalArgumentException,
java.nio.file.FileSystemAlreadyExistsException,
java.nio.file.ProviderNotFoundException,
java.io.IOException,
java.lang.SecurityException
zipFile - The ZIP-archive to get the list of files from.java.lang.IllegalArgumentException - if the pre-conditions for the uri parameter are not
met, or the env parameter does not contain properties
required by the provider, or a property value is
invalid.java.nio.file.FileSystemAlreadyExistsException - if the file system has already been created.java.nio.file.ProviderNotFoundException - if a provider supporting the URI scheme is not
installed.java.io.IOException - if an I/O error occurs creating the file system.java.lang.SecurityException - if a security manager is installed, and it denies an
unspecified permission required by the file system
provider implementation.public java.util.List<java.lang.String> getAllFilesAndDirectoriesInModpackZip(net.lingala.zip4j.ZipFile zipFile)
throws java.lang.IllegalArgumentException,
java.nio.file.FileSystemAlreadyExistsException,
java.nio.file.ProviderNotFoundException,
java.io.IOException,
java.lang.SecurityException
zipFile - The ZIP-archive to get the list of files from.java.lang.IllegalArgumentException - if the pre-conditions for the uri parameter are not
met, or the env parameter does not contain properties
required by the provider, or a property value is
invalid.java.nio.file.FileSystemAlreadyExistsException - if the file system has already been created.java.nio.file.ProviderNotFoundException - if a provider supporting the URI scheme is not
installed.java.io.IOException - if an I/O error occurs creating the file system.java.lang.SecurityException - if a security manager is installed, and it denies an
unspecified permission required by the file system
provider implementation.