@Component
public class DefaultFiles
extends java.lang.Object
LocalizationManager for use of localization, but creates one if injected one is null.
Ensures all files needed by ServerPackCreator are available. If any one is missing, a new one is generated from the template. Among the default files are:
serverpackcreator.conf
server.properties
server-icon.png
start-forge.bar
start-forge.sh
start-fabric.bat
start-fabric.sh
Should an old configuration file, creator.conf, be detected, it is renamed to serverpackcreator.conf to ensure a configuration file is present at all times.
| Constructor and Description |
|---|
DefaultFiles(LocalizationManager injectedLocalizationManager,
ApplicationProperties injectedApplicationProperties)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkDatabase()
Ensures serverpackcreator.db exists.
|
boolean |
checkForFile(java.io.File fileToCheckFor)
Checks for existence of defaults files.
|
void |
filesSetup()
Calls individual methods which check for existence of default files.
|
java.net.URL |
getFabricInstallerManifestUrl()
Getter for the URL to the Fabric Installer Manifest.
|
java.net.URL |
getFabricManifestUrl()
Getter for Fabric's version-manifest.
|
java.net.URL |
getForgeManifestUrl()
Getter for Forge's version-manifest.
|
java.net.URL |
getMinecraftManifestUrl()
Getter for Mojang's Minecraft version-manifest.
|
void |
refreshManifestFile(java.net.URL manifestUrl,
java.io.File manifestToRefresh)
Deletes the specified manifest if it is found, then downloads the specified manifest file again.
|
@Autowired public DefaultFiles(LocalizationManager injectedLocalizationManager, ApplicationProperties injectedApplicationProperties)
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.public java.net.URL getMinecraftManifestUrl()
public java.net.URL getForgeManifestUrl()
public java.net.URL getFabricManifestUrl()
public java.net.URL getFabricInstallerManifestUrl()
public void filesSetup()
If any file was newly generated from its template, a warning is printed informing the user about said newly generated file. If every file was present and none was generated, "Setup completed." is printed to the console and log.
public boolean checkForFile(java.io.File fileToCheckFor)
fileToCheckFor - The file which is to be checked for whether it exists and if it doesn't, should be created.filesSetup() can inform the user about
said newly generated file.public void refreshManifestFile(java.net.URL manifestUrl,
java.io.File manifestToRefresh)
manifestUrl - The URL to the file which is to be downloaded.manifestToRefresh - The manifest file to delete and then download, "refreshing" itpublic void checkDatabase()