@Component
public class CurseCreateModpack
extends java.lang.Object
First: the configuration is checked for a valid CurseForge projectID,fileID combination.
Second: The folder structure is checked for an already existing folder with FileDisplayName and if it exists it is deleted.
Third: The modpack is created and all mods are downloaded etc., files are copied, etc.
Fourth: Information about the modpack is acquired from the modpack's manifest.json and written to a new configuration file
with said information. The configuration for modpackDir, which previously contained a projectID,fileID is replaced
with the path to the new modpack at ProjectName/FileDisplayName.
If modpackDir holds a projectID,fileID combination we have to assume the modpack has yet to be created, thus
we need to make sure the target directory is empty in order to create a clean and fresh modpack.
If modpackDir does not hold a projectID,fileID we have to assume it is a path pointing at a directory which already
contains a modpack we can work with and create a server pack from. Thus, we clean up the environment if modpackDir holds
a projectID,fileID.
| Constructor and Description |
|---|
CurseCreateModpack(LocalizationManager injectedLocalizationManager,
ApplicationProperties injectedApplicationProperties,
VersionMeta injectedVersionMeta,
Utilities injectedUtilities,
ConfigUtilities injectedConfigUtilities)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupEnvironment(java.lang.String modpackDir)
Deletes any and all folder and files, recursively, inside the target directory, thus ensuring we are working in a
clean environment when creating a new modpack from CurseForge.
|
void |
curseForgeModpack(ConfigurationModel configurationModel,
java.lang.Integer projectID,
java.lang.Integer fileID)
Acquires the names of the CurseForge project and file.
|
java.lang.String |
retrieveFileDiskName(int newProjectID,
int newFileID)
Retrieve the file disk-name of a given CurseForge project.
|
java.lang.String |
retrieveFileName(int projectID,
int fileID)
Get the display-name of the project's file.
|
java.lang.String |
retrieveProjectName(int newProjectID)
Retrieve the name of a given CurseForge project.
|
@Autowired public CurseCreateModpack(LocalizationManager injectedLocalizationManager, ApplicationProperties injectedApplicationProperties, VersionMeta injectedVersionMeta, 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.
injectedLocalizationManager - Instance of LocalizationManager required for localized log messages.injectedApplicationProperties - Instance of Properties required for various different things.injectedVersionMeta - Instance of VersionMeta.injectedUtilities - Instance of Utilities.injectedConfigUtilities - Instance ConfigUtilitiesjava.io.IOException - if the VersionMeta could not be instantiated.public java.lang.String retrieveProjectName(int newProjectID)
newProjectID - The ID of the new CurseForge project.public java.lang.String retrieveFileDiskName(int newProjectID,
int newFileID)
newProjectID - The ID of the CurseForge project.newFileID - The ID of the CurseForge file.public java.lang.String retrieveFileName(int projectID,
int fileID)
projectID - int. The id of the project.fileID - int. The id of the file.public void curseForgeModpack(ConfigurationModel configurationModel, java.lang.Integer projectID, java.lang.Integer fileID)
configurationModel - Instance of ConfigurationModel. Required for getting the directory in which we
will create our modpack.projectID - Integer. The ID of the project. Used to gather information about the CurseForge project and to
download the modpack.fileID - Integer. The ID of the file. Used to gather information about the CurseForge file and to download
the modpack.public void cleanupEnvironment(java.lang.String modpackDir)
modpackDir - String. The directory we want to delete.