@Component
public class ConfigUtilities
extends java.lang.Object
| Constructor and Description |
|---|
ConfigUtilities(LocalizationManager injectedLocalizationManager,
Utilities injectedUtilities,
ApplicationProperties injectedApplicationProperties,
VersionMeta injectedVersionMeta) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkCurseForgeJsonForFabric(com.fasterxml.jackson.databind.JsonNode modpackJson)
Checks whether the projectID for the Jumploader mod is present in the list of mods required by the CurseForge modpack.
|
java.util.List<java.lang.String> |
directoriesInModpackZip(java.nio.file.Path zipURI)
Acquire a list of directories in a ZIP-file.
|
java.util.List<java.lang.String> |
getConfigurationAsList(ConfigurationModel configurationModel)
Creates a list of all configurations as they appear in the serverpackcreator.conf to pass it to any addon that may run.
|
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 |
updateConfigModelFromConfigJson(ConfigurationModel configurationModel,
java.io.File config)
Update the given ConfigurationModel with values gathered from the modpacks config.json.
|
void |
updateConfigModelFromCurseManifest(ConfigurationModel configurationModel,
java.io.File manifest)
Update the given ConfigurationModel with values gathered from the downloaded CurseForge modpack.
|
void |
updateConfigModelFromMinecraftInstance(ConfigurationModel configurationModel,
java.io.File minecraftInstance)
Update the given ConfigurationModel with values gathered from the minecraftinstance.json of the modpack.
|
void |
updateConfigModelFromMMCPack(ConfigurationModel configurationModel,
java.io.File mmcPack)
Update the given ConfigurationModel with values gathered from the modpacks mmc-pack.json.
|
java.lang.String |
updateDestinationFromInstanceCfg(java.io.File instanceCfg)
Acquire the name of the modpack/instance of a MultiMC modpack from the modpacks instance.cfg, which is usually
created by the MultiMC launcher.
|
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(LocalizationManager injectedLocalizationManager, Utilities injectedUtilities, ApplicationProperties injectedApplicationProperties, VersionMeta injectedVersionMeta) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getModLoaderCase(java.lang.String modloader)
modloader - String. 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 - String. The path to the modpack.clientMods - List, String. List of clientside-only mods.copyDirs - List, String. List of directories to include in server pack.serverIconPath - String. The path to the custom server-icon.png to include in the server pack.serverPropertiesPath - String. The path to the custom server.properties to include in the server pack.includeServer - Boolean. Whether the modloader server software should be installed.javaPath - String. Path to the java executable/binary.minecraftVersion - String. Minecraft version used by the modpack and server pack.modLoader - String. Modloader used by the modpack and server pack. Ether Forge or Fabric.modLoaderVersion - String. Modloader version used by the modpack and server pack.includeIcon - Boolean. Whether to include a server-icon in the server pack.includeProperties - Boolean. Whether to include a properties file in the server pack.includeZip - Boolean. Whether to create a ZIP-archive of the server pack, excluding Mojang's Minecraft server JAR.javaArgs - String. Java arguments to write the start-scripts with.serverPackSuffix - String. Suffix to append to the server pack to be generated.fileName - The name under which to write the new configuration file.public java.util.List<java.lang.String> getConfigurationAsList(ConfigurationModel configurationModel)
configurationModel - An instance of ConfigurationModel which contains the configuration of the modpack.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 - String. The used modpackDir field either from a configuration file or from configuration setup.clientsideMods - String List. List of clientside-only mods to exclude from the server pack...copyDirectories - String List. List of directories in the modpack which are to be included in the server pack.installServer - Boolean. Whether to install the modloader server in the server pack.javaInstallPath - String. Path to the Java executable/binary needed for installing the modloader server in the server pack.minecraftVer - String. The Minecraft version the modpack uses.modloader - String. The modloader the modpack uses.modloaderVersion - String. The version of the modloader the modpack uses.includeIcon - Boolean. Whether to include the server-icon.png in the server pack.includeProperties - Boolean. Whether to include the server.properties in the server pack.includeZip - Boolean. Whether to create a zip-archive of the server pack, excluding the Minecraft server JAR according to Mojang's TOS and EULA.javaArgs - String. Java arguments to write the start-scripts with.serverPackSuffix - String. Suffix to append to name of the server pack to be generated.serverIconPath - String. The path to the custom server-icon.png to be used in the server pack.serverPropertiesPath - String. The path to the custom server.properties to be used in the server pack.public void updateConfigModelFromCurseManifest(ConfigurationModel configurationModel, java.io.File manifest) throws java.io.IOException
configurationModel - 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
configurationModel - 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
configurationModel - ConfigurationModel. An instance containing a configuration for a modpack from which
to create a server pack.config - File. 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
configurationModel - ConfigurationModel. An instance containing a configuration for a modpack from which
to create a server pack.mmcPack - File. 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
instanceCfg - File. The config.json-file of the modpack to read.String Returns the instance name.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 - String. The directory for which to gather a list of directories to copy to the server pack.public boolean checkCurseForgeJsonForFabric(com.fasterxml.jackson.databind.JsonNode modpackJson)
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> directoriesInModpackZip(java.nio.file.Path zipURI)
throws java.lang.IllegalArgumentException,
java.nio.file.FileSystemAlreadyExistsException,
java.nio.file.ProviderNotFoundException,
java.io.IOException,
java.lang.SecurityException
zipURI - URI to the ZIP-file from which to gather a list of directories within.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.