@Component
public class ConfigurationHandler
extends java.lang.Object
CurseCreateModpack in order to create a modpack from scratch should the specified modpackDir
be a combination of a CurseForge projectID and fileID.
Requires an instance of LocalizationManager for use of localization, but creates one if injected one is null.
Loads a configuration from a serverpackcreator.conf-file in the same directory in which ServerPackCreator resides in.
| Constructor and Description |
|---|
ConfigurationHandler(LocalizationManager injectedLocalizationManager,
CurseCreateModpack injectedCurseCreateModpack,
VersionMeta injectedVersionMeta,
ApplicationProperties injectedApplicationProperties,
Utilities injectedUtilities,
ConfigUtilities injectedConfigUtilities)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkConfiguration(@NotNull ConfigurationModel configurationModel,
boolean quietCheck)
Check the passed
ConfigurationModel. |
boolean |
checkConfiguration(@NotNull ConfigurationModel configurationModel,
boolean downloadAndCreateModpack,
boolean quietCheck)
Check the passed
ConfigurationModel. |
boolean |
checkConfiguration(@NotNull ConfigurationModel configurationModel,
@NotNull java.util.List<java.lang.String> encounteredErrors,
boolean downloadAndCreateModpack,
boolean quietCheck)
Check the passed
ConfigurationModel. |
boolean |
checkConfiguration(@NotNull java.io.File configFile,
boolean quietCheck)
Check the passed configuration-file.
|
boolean |
checkConfiguration(@NotNull java.io.File configFile,
boolean downloadAndCreateModpack,
boolean quietCheck)
Check the passed configuration-file.
|
boolean |
checkConfiguration(@NotNull java.io.File configFile,
@NotNull ConfigurationModel configurationModel,
boolean quietCheck)
Check the passed configuration-file.
|
boolean |
checkConfiguration(@NotNull java.io.File configFile,
@NotNull ConfigurationModel configurationModel,
boolean downloadAndCreateModpack,
boolean quietCheck)
Check the passed configuration-file.
|
boolean |
checkConfiguration(@NotNull java.io.File configFile,
@NotNull ConfigurationModel configurationModel,
@NotNull java.util.List<java.lang.String> encounteredErrors,
boolean downloadAndCreateModpack,
boolean quietCheck)
Check the passed configuration-file.
|
boolean |
checkConfiguration(@NotNull java.io.File configFile,
@NotNull java.util.List<java.lang.String> encounteredErrors,
boolean quietCheck)
Check the passed configuration-file.
|
boolean |
checkCopyDirs(java.util.List<java.lang.String> directoriesToCopy,
java.lang.String modpackDir)
Checks whether the passed list of directories which are supposed to be in the modpack directory is empty, or
whether all directories in the list exist in the modpack directory.
|
boolean |
checkCopyDirs(java.util.List<java.lang.String> directoriesToCopy,
java.lang.String modpackDir,
java.util.List<java.lang.String> encounteredErrors)
Checks whether the passed list of directories which are supposed to be in the modpack directory is empty and
prints a message to the console and serverpackcreator.log if it is.
Checks whether all directories in the list exist in the modpack directory and prints a message to the console and serverpackcreator.log if any one of the directories could not be found. |
boolean |
checkCurseForge(java.lang.String modpackDir,
ConfigurationModel configurationModel,
java.util.List<java.lang.String> encounteredErrors)
Checks whether the specified modpack directory contains a valid projectID,fileID combination.
|
boolean |
checkIconAndProperties(java.lang.String iconOrPropertiesPath)
Checks the passed String whether it is an existing file.
|
boolean |
checkJavaPath(java.lang.String pathToJava)
Check whether the given path is a valid file.
|
boolean |
checkModloader(java.lang.String modloader)
Checks whether either Forge or Fabric were specified as the modloader.
|
boolean |
checkModloaderVersion(java.lang.String modloader,
java.lang.String modloaderVersion,
java.lang.String minecraftVersion)
Check the given Minecraft and modloader versions for the specified modloader.
|
boolean |
checkModpackDir(java.lang.String modpackDir)
Check the passed directory for existence and whether it is a directory, rather than a file.
|
boolean |
checkModpackDir(java.lang.String modpackDir,
java.util.List<java.lang.String> encounteredErrors)
Checks whether the passed String is empty and if it is empty, prints the corresponding message to the console and
serverpackcreator.log so the user knows what went wrong.
Checks whether the passed String is a directory and if it is not, prints the corresponding message to the console and serverpackcreator.log so the user knows what went wrong. |
boolean |
checkZipArchive(java.nio.file.Path pathToZip,
java.util.List<java.lang.String> encounteredErrors)
Check a given ZIP-archives contents.
|
java.lang.String |
getJavaPath(java.lang.String pathToJava)
Checks whether the passed String ends with
java.exe or java and whether the files exist. |
@Autowired public ConfigurationHandler(LocalizationManager injectedLocalizationManager, CurseCreateModpack injectedCurseCreateModpack, VersionMeta injectedVersionMeta, ApplicationProperties injectedApplicationProperties, Utilities injectedUtilities, ConfigUtilities injectedConfigUtilities) throws java.io.IOException
Used for Dependency Injection.
Receives an instance of LocalizationManager or creates one if the received
one is null. Required for use of localization.
Receives an instance of CurseCreateModpack in case the modpack has to be created from a combination of
CurseForge projectID and fileID, from which to then create the server pack.
injectedLocalizationManager - Instance of LocalizationManager required for localized log messages.injectedCurseCreateModpack - Instance of CurseCreateModpack in case the modpack has to be created from a combination of
CurseForge projectID and fileID, from which to then create the server pack.injectedApplicationProperties - Instance of Properties required for various different things.injectedVersionMeta - Instance of VersionMeta required for everything version-related.injectedUtilities - Instance of Utilities.injectedConfigUtilities - Instance of ConfigUtilities.java.io.IOException - if the VersionMeta could not be instantiated.public boolean checkConfiguration(@NotNull
@NotNull ConfigurationModel configurationModel,
boolean quietCheck)
ConfigurationModel. If any check returns true
then the server pack will not be created. In order to find out which check failed, the user has to check their
serverpackcreator.log in the logs-directory.configurationModel - ConfigurationModel. Instance of a configuration of a modpack. Can be used to further display or use any information within, as it may be changed
or otherwise altered by this method.quietCheck - Boolean. Whether the configuration should be printed to the console and logs. Pass false to quietly check the configuration.false if the configuration has passed all tests.public boolean checkConfiguration(@NotNull
@NotNull java.io.File configFile,
boolean quietCheck)
true
then the server pack will not be created. In order to find out which check failed, the user has to check their
serverpackcreator.log in the logs-directory.configFile - File. The configuration file to check. Must either be an existing file to load a configuration
from or null if you want to use the passed configuration model.quietCheck - Boolean. Whether the configuration should be printed to the console and logs. Pass false to quietly check the configuration.false if the configuration has passed all tests.public boolean checkConfiguration(@NotNull
@NotNull java.io.File configFile,
@NotNull
@NotNull java.util.List<java.lang.String> encounteredErrors,
boolean quietCheck)
true
then the server pack will not be created. In order to find out which check failed, the user has to check their
serverpackcreator.log in the logs-directory.configFile - File. The configuration file to check. Must either be an existing file to load a configuration
from or null if you want to use the passed configuration model.encounteredErrors - List String. A list of errors encountered during configuration checks which gets printed
to the console and log after all checks have run. Gives the user more detail on what
went wrong at which part of their configuration. Can be used to display the errors, if any were encountered,
in a UI or be printed into the console or whatever have you.quietCheck - Boolean. Whether the configuration should be printed to the console and logs. Pass false to quietly check the configuration.false if the configuration has passed all tests.public boolean checkConfiguration(@NotNull
@NotNull java.io.File configFile,
@NotNull
@NotNull ConfigurationModel configurationModel,
boolean quietCheck)
true
then the server pack will not be created. In order to find out which check failed, the user has to check their
serverpackcreator.log in the logs-directory.configFile - File. The configuration file to check. Must either be an existing file to load a configuration
from or null if you want to use the passed configuration model.configurationModel - ConfigurationModel. Instance of a configuration of a modpack. Can be used to further display or use any information within, as it may be changed
or otherwise altered by this method.quietCheck - Boolean. Whether the configuration should be printed to the console and logs. Pass false to quietly check the configuration.false if the configuration has passed all tests.public boolean checkConfiguration(@NotNull
@NotNull java.io.File configFile,
boolean downloadAndCreateModpack,
boolean quietCheck)
true
then the server pack will not be created. In order to find out which check failed, the user has to check their
serverpackcreator.log in the logs-directory.configFile - File. The configuration file to check. Must either be an existing file to load a configuration
from or null if you want to use the passed configuration model.downloadAndCreateModpack - Boolean. Whether the CurseForge modpack should be downloaded and created.quietCheck - Boolean. Whether the configuration should be printed to the console and logs. Pass false to quietly check the configuration.false if the configuration has passed all tests.public boolean checkConfiguration(@NotNull
@NotNull java.io.File configFile,
@NotNull
@NotNull ConfigurationModel configurationModel,
boolean downloadAndCreateModpack,
boolean quietCheck)
true
then the server pack will not be created. In order to find out which check failed, the user has to check their
serverpackcreator.log in the logs-directory.configFile - File. The configuration file to check. Must either be an existing file to load a configuration
from or null if you want to use the passed configuration model.configurationModel - ConfigurationModel. Instance of a configuration of a modpack. Can be used to further display or use any information within, as it may be changed
or otherwise altered by this method.downloadAndCreateModpack - Boolean. Whether the CurseForge modpack should be downloaded and created.quietCheck - Boolean. Whether the configuration should be printed to the console and logs. Pass false to quietly check the configuration.false if the configuration has passed all tests.public boolean checkConfiguration(@NotNull
@NotNull ConfigurationModel configurationModel,
boolean downloadAndCreateModpack,
boolean quietCheck)
ConfigurationModel. If any check returns true
then the server pack will not be created. In order to find out which check failed, the user has to check their
serverpackcreator.log in the logs-directory.configurationModel - ConfigurationModel. Instance of a configuration of a modpack. Can be used to further display or use any information within, as it may be changed
or otherwise altered by this method.downloadAndCreateModpack - Boolean. Whether the CurseForge modpack should be downloaded and created.quietCheck - Boolean. Whether the configuration should be printed to the console and logs. Pass false to quietly check the configuration.false if the configuration has passed all tests.public boolean checkConfiguration(@NotNull
@NotNull java.io.File configFile,
@NotNull
@NotNull ConfigurationModel configurationModel,
@NotNull
@NotNull java.util.List<java.lang.String> encounteredErrors,
boolean downloadAndCreateModpack,
boolean quietCheck)
true
then the server pack will not be created. In order to find out which check failed, the user has to check their
serverpackcreator.log in the logs-directory.configFile - File. The configuration file to check. Must either be an existing file to load a configuration
from or null if you want to use the passed configuration model.configurationModel - ConfigurationModel. Instance of a configuration of a modpack. Can be used to further display or use any information within, as it may be changed
or otherwise altered by this method.encounteredErrors - List String. A list of errors encountered during configuration checks which gets printed
to the console and log after all checks have run. Gives the user more detail on what
went wrong at which part of their configuration. Can be used to display the errors, if any were encountered,
in a UI or be printed into the console or whatever have you.downloadAndCreateModpack - Boolean. Whether the CurseForge modpack should be downloaded and created.quietCheck - Boolean. Whether the configuration should be printed to the console and logs. Pass false to quietly check the configuration.false if the configuration has passed all tests.public boolean checkConfiguration(@NotNull
@NotNull ConfigurationModel configurationModel,
@NotNull
@NotNull java.util.List<java.lang.String> encounteredErrors,
boolean downloadAndCreateModpack,
boolean quietCheck)
ConfigurationModel. If any check returns true
then the server pack will not be created. In order to find out which check failed, the user has to check their
serverpackcreator.log in the logs-directory.encounteredErrors can be used to display the errors, if any were encountered,
in a UI or be printed into the console or whatever have you.ConfigurationModel can be used to further display or use any information within, as it may be changed
or otherwise altered by this method.configurationModel - ConfigurationModel. Instance of a configuration of a modpack. Can be used to further display or use any information within, as it may be changed
or otherwise altered by this method.encounteredErrors - List String. A list of errors encountered during configuration checks which gets printed
to the console and log after all checks have run. Gives the user more detail on what
went wrong at which part of their configuration. Can be used to display the errors, if any were encountered,
in a UI or be printed into the console or whatever have you.downloadAndCreateModpack - Boolean. Whether the CurseForge modpack, if specified, should be downloaded and created.quietCheck - Boolean. Whether the configuration should be printed to the console and logs. Pass false to quietly check the configuration.false if all checks are passed.public boolean checkZipArchive(java.nio.file.Path pathToZip,
java.util.List<java.lang.String> encounteredErrors)
pathToZip - Path to the ZIP-file to check.encounteredErrors - String List. List of encountered errors for further processing, like printing to logs or
display in GUI or whatever you want, really.public boolean checkCurseForge(java.lang.String modpackDir,
ConfigurationModel configurationModel,
java.util.List<java.lang.String> encounteredErrors)
throws InvalidModpackException,
InvalidFileException,
com.therandomlabs.curseapi.CurseException
modpackDir - String. The string which to check for a valid projectID,fileID combination.configurationModel - or ServerPackModel. Instance containing
all the information about our server pack.encounteredErrors - List String. A list to which all encountered errors are saved to.InvalidModpackException - Thrown if the specified IDs do not match a CurseForge modpack.InvalidFileException - Thrown if the specified fileID does not match a file for the projectID.com.therandomlabs.curseapi.CurseException - Thrown if an error occurs working with the CurseForgeAPI.public boolean checkModpackDir(java.lang.String modpackDir)
modpackDir - String The modpack directory.public boolean checkModpackDir(java.lang.String modpackDir,
java.util.List<java.lang.String> encounteredErrors)
modpackDir - String. The path to the modpack directory to check whether it is empty and whether it is a directory.encounteredErrors - List String. A list to which all encountered errors are saved to.public boolean checkCopyDirs(java.util.List<java.lang.String> directoriesToCopy,
java.lang.String modpackDir)
source/file;destination/file-combination, it is checked whether the specified source-file exists
on the host.directoriesToCopy - List String. The list of directories, or source/file;destination/file-combinations,
to check for existence. source/file;destination/file-combinations must be
absolute paths to the source-file.modpackDir - String. The path to the modpack directory in which to check for existence of the passed list
of directories.public boolean checkCopyDirs(java.util.List<java.lang.String> directoriesToCopy,
java.lang.String modpackDir,
java.util.List<java.lang.String> encounteredErrors)
source/file;destination/file-combination, it is checked whether the specified
source-file exists on the host.directoriesToCopy - List String. The list of directories, or source/file;destination/file-combinations,
to check for existence. source/file;destination/file-combinations must be
absolute paths to the source-file.modpackDir - String. The path to the modpack directory in which to check for existence of the passed list of
directories.encounteredErrors - List String. A list to which all encountered errors are saved to.public boolean checkIconAndProperties(java.lang.String iconOrPropertiesPath)
iconOrPropertiesPath - String. The path to the custom server-icon.png or server.properties file to check.public boolean checkJavaPath(java.lang.String pathToJava)
pathToJava - String Path to the Java executabletrue if the path is valid.public java.lang.String getJavaPath(java.lang.String pathToJava)
java.exe or java and whether the files exist.pathToJava - String. The path to check for java.exe and java.public boolean checkModloader(java.lang.String modloader)
modloader - String. Check as case-insensitive for Forge or Fabric.public boolean checkModloaderVersion(java.lang.String modloader,
java.lang.String modloaderVersion,
java.lang.String minecraftVersion)
modloader - String. The passed modloader which determines whether the check for Forge or Fabric is called.modloaderVersion - String. The version of the modloader which is checked against the corresponding modloaders manifest.minecraftVersion - String. The version of Minecraft used for checking the Forge version.