@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,
VersionLister injectedVersionLister,
ApplicationProperties injectedApplicationProperties,
BooleanUtilities injectedBooleanUtilities,
ListUtilities injectedListUtilities,
StringUtilities injectedStringUtilities,
SystemUtilities injectedSystemUtilities,
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,
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.
|
java.lang.String |
checkJavaPath(java.lang.String pathToJava)
Checks whether the passed String ends with
java.exe or java and whether the files exist. |
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)
Depending on whether Forge or Fabric was specified as the modloader, this will call the corresponding version check
to verify that the user correctly set their modloader version.
If the user specified Forge as their modloader, isForgeVersionCorrect(String, String) is called and the version
the user specified is checked against Forge's version manifest..If the user specified Fabric as their modloader, isFabricVersionCorrect(String) is called and the version
the user specified is checked against Fabric's version manifest. |
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.
|
boolean |
isFabricVersionCorrect(java.lang.String fabricVersion)
Check whether the specified Fabric version is correct by searching the version list of the Fabric manifest
for the specified version.
|
boolean |
isForgeVersionCorrect(java.lang.String forgeVersion,
java.lang.String minecraftVersion)
Check whether the specified Forge version is correct by searching the version list of the Forge manifest
for the specified version.
|
boolean |
isMinecraftVersionCorrect(java.lang.String minecraftVersion)
Check whether the specified Minecraft version is correct by searching the version list of the Minecraft manifest
for the specified version.
|
@Autowired public ConfigurationHandler(LocalizationManager injectedLocalizationManager, CurseCreateModpack injectedCurseCreateModpack, VersionLister injectedVersionLister, ApplicationProperties injectedApplicationProperties, BooleanUtilities injectedBooleanUtilities, ListUtilities injectedListUtilities, StringUtilities injectedStringUtilities, SystemUtilities injectedSystemUtilities, ConfigUtilities injectedConfigUtilities)
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.injectedVersionLister - Instance of VersionLister required for everything version-related.injectedBooleanUtilities - Instance of BooleanUtilities.injectedListUtilities - Instance of ListUtilities.injectedStringUtilities - Instance of StringUtilities.injectedSystemUtilities - Instance of SystemUtilities.injectedConfigUtilities - Instance of ConfigUtilities.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,
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,
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 java.lang.String checkJavaPath(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)
isForgeVersionCorrect(String, String) is called and the version
the user specified is checked against Forge's version manifest..isFabricVersionCorrect(String) is called and the version
the user specified is checked against Fabric's version manifest.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.public boolean isMinecraftVersionCorrect(java.lang.String minecraftVersion)
minecraftVersion - String. The version to check for in Minecraft's version manifest.public boolean isFabricVersionCorrect(java.lang.String fabricVersion)
fabricVersion - String. The version to check for in Fabric's version manifest.public boolean isForgeVersionCorrect(java.lang.String forgeVersion,
java.lang.String minecraftVersion)
forgeVersion - String. The version to check for in Forge's version manifest.minecraftVersion - String. The minecraft version to check the Forge version with.