Class ApiProperties
-
- All Implemented Interfaces:
@Plugin(name = "ServerPackCreatorConfigFactory", category = "Core") public final class ApiProperties extends ConfigurationFactoryBase settings of ServerPackCreator, such as working directories, default list of clientside-only mods, default list of directories to include in a server pack, script templates, java paths and much more.
Griefed
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classApiProperties.CustomXMLConfigurationCustom XmlConfiguration to pass our custom log4j2.xml config to log4j.
Set up the XML configuration with the passed context and config source. For the config source being used, ApiProperties.getConfiguration where multiple attempts at creating a new private val log by lazy { cachedLoggerOf(this.javaClass) } using our own log4j2.xml are made before the default log4j setup is used.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ApiProperties(File propertiesFile)
-
Method Summary
-
Methods inherited from class org.apache.logging.log4j.core.config.ConfigurationFactory
getConfiguration, getConfiguration, getDefaultPrefix, getInputFromString, getTestPrefix, getVersion, isActive -
Methods inherited from class de.griefed.serverpackcreator.api.ApiProperties
getSupportedTypes -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ApiProperties
ApiProperties(File propertiesFile)
- Parameters:
propertiesFile- serverpackcreator.properties-file containing settings and configurations to load the API with.
-
-
Method Detail
-
getFallbackDirectoriesInclusion
final TreeSet<String> getFallbackDirectoriesInclusion()
-
getFallbackDirectoriesExclusion
final TreeSet<String> getFallbackDirectoriesExclusion()
-
getFallbackZipExclusions
final TreeSet<String> getFallbackZipExclusions()
-
getFallbackPostInstallCleanupFiles
final TreeSet<String> getFallbackPostInstallCleanupFiles()
-
getFallbackPreInstallCleanupFiles
final TreeSet<String> getFallbackPreInstallCleanupFiles()
-
getFallbackAikarsFlags
final String getFallbackAikarsFlags()
-
getFallbackUpdateURL
final String getFallbackUpdateURL()
-
getFallbackExclusionFilter
final ExclusionFilter getFallbackExclusionFilter()
-
getFallbackOverwriteEnabled
final Boolean getFallbackOverwriteEnabled()
-
getFallbackJavaScriptAutoupdateEnabled
final Boolean getFallbackJavaScriptAutoupdateEnabled()
-
getFallbackCheckingForPreReleasesEnabled
final Boolean getFallbackCheckingForPreReleasesEnabled()
-
getFallbackZipFileExclusionEnabled
final Boolean getFallbackZipFileExclusionEnabled()
-
getFallbackServerPackCleanupEnabled
final Boolean getFallbackServerPackCleanupEnabled()
-
getFallbackMinecraftPreReleasesAvailabilityEnabled
final Boolean getFallbackMinecraftPreReleasesAvailabilityEnabled()
-
getFallbackAutoExcludingModsEnabled
final Boolean getFallbackAutoExcludingModsEnabled()
-
getFallbackArtemisQueueMaxDiskUsage
final Integer getFallbackArtemisQueueMaxDiskUsage()
-
getFallbackCleanupSchedule
final String getFallbackCleanupSchedule()
-
getFallbackVersionSchedule
final String getFallbackVersionSchedule()
-
getFallbackDatabaseCleanupSchedule
final String getFallbackDatabaseCleanupSchedule()
-
getFallbackUpdateServerPack
final Boolean getFallbackUpdateServerPack()
-
getI18n4kConfig
final I18n4kConfigDefault getI18n4kConfig()
-
getClientsideMods
final TreeSet<String> getClientsideMods()
-
getModsWhitelist
final TreeSet<String> getModsWhitelist()
-
getClientsideModsRegex
final TreeSet<String> getClientsideModsRegex()
-
getModsWhitelistRegex
final TreeSet<String> getModsWhitelistRegex()
-
getSupportedModloaders
final Array<String> getSupportedModloaders()
-
getApiVersion
final String getApiVersion()
-
getDevBuild
final Boolean getDevBuild()
-
getPreRelease
final Boolean getPreRelease()
-
getConfigVersion
final String getConfigVersion()
-
getFirstRun
final Boolean getFirstRun()
-
getLogLevel
final String getLogLevel()
-
setLogLevel
final Unit setLogLevel(String value)
-
getDirectoriesToInclude
final TreeSet<String> getDirectoriesToInclude()
-
setDirectoriesToInclude
final Unit setDirectoriesToInclude(TreeSet<String> value)
-
getDirectoriesToExclude
final TreeSet<String> getDirectoriesToExclude()
-
setDirectoriesToExclude
final Unit setDirectoriesToExclude(TreeSet<String> value)
-
getPostInstallCleanupFiles
final TreeSet<String> getPostInstallCleanupFiles()
-
setPostInstallCleanupFiles
final Unit setPostInstallCleanupFiles(TreeSet<String> value)
-
getPreInstallCleanupFiles
final TreeSet<String> getPreInstallCleanupFiles()
-
setPreInstallCleanupFiles
final Unit setPreInstallCleanupFiles(TreeSet<String> value)
-
getZipArchiveExclusions
final TreeSet<String> getZipArchiveExclusions()
-
setZipArchiveExclusions
final Unit setZipArchiveExclusions(TreeSet<String> value)
-
getJavaPaths
final HashMap<String, String> getJavaPaths()
-
setJavaPaths
final Unit setJavaPaths(HashMap<String, String> values)
-
getScriptTemplates
final TreeSet<File> getScriptTemplates()
-
setScriptTemplates
final Unit setScriptTemplates(TreeSet<File> value)
-
getStartScriptTemplates
final HashMap<String, String> getStartScriptTemplates()
-
setStartScriptTemplates
final Unit setStartScriptTemplates(HashMap<String, String> map)
-
getJavaScriptTemplates
final HashMap<String, String> getJavaScriptTemplates()
-
setJavaScriptTemplates
final Unit setJavaScriptTemplates(HashMap<String, String> map)
-
getUpdateUrl
final URL getUpdateUrl()
-
setUpdateUrl
final Unit setUpdateUrl(URL value)
-
getExclusionFilter
final ExclusionFilter getExclusionFilter()
-
setExclusionFilter
final Unit setExclusionFilter(ExclusionFilter value)
-
isCheckingForPreReleasesEnabled
final Boolean isCheckingForPreReleasesEnabled()
-
setCheckingForPreReleasesEnabled
final Unit setCheckingForPreReleasesEnabled(Boolean value)
-
isZipFileExclusionEnabled
final Boolean isZipFileExclusionEnabled()
-
setZipFileExclusionEnabled
final Unit setZipFileExclusionEnabled(Boolean value)
-
isAutoExcludingModsEnabled
final Boolean isAutoExcludingModsEnabled()
-
setAutoExcludingModsEnabled
final Unit setAutoExcludingModsEnabled(Boolean value)
-
isServerPacksOverwriteEnabled
final Boolean isServerPacksOverwriteEnabled()
-
setServerPacksOverwriteEnabled
final Unit setServerPacksOverwriteEnabled(Boolean value)
-
isServerPackCleanupEnabled
final Boolean isServerPackCleanupEnabled()
-
setServerPackCleanupEnabled
final Unit setServerPackCleanupEnabled(Boolean value)
-
isMinecraftPreReleasesAvailabilityEnabled
final Boolean isMinecraftPreReleasesAvailabilityEnabled()
-
setMinecraftPreReleasesAvailabilityEnabled
final Unit setMinecraftPreReleasesAvailabilityEnabled(Boolean value)
-
isUpdatingServerPacksEnabled
final Boolean isUpdatingServerPacksEnabled()
-
setUpdatingServerPacksEnabled
final Unit setUpdatingServerPacksEnabled(Boolean value)
-
isJavaScriptAutoupdateEnabled
final Boolean isJavaScriptAutoupdateEnabled()
-
setJavaScriptAutoupdateEnabled
final Unit setJavaScriptAutoupdateEnabled(Boolean value)
-
getAikarsFlags
final String getAikarsFlags()
-
setAikarsFlags
final Unit setAikarsFlags(String value)
-
getDatabaseUri
final String getDatabaseUri()
-
setDatabaseUri
final Unit setDatabaseUri(String value)
-
getLanguage
final Locale getLanguage()
-
setLanguage
final Unit setLanguage(Locale value)
-
getHasteBinServerUrl
final String getHasteBinServerUrl()
-
setHasteBinServerUrl
final Unit setHasteBinServerUrl(String value)
-
getJavaPath
final String getJavaPath()
-
setJavaPath
final Unit setJavaPath(String value)
-
getWebserviceCleanupSchedule
final String getWebserviceCleanupSchedule()
-
setWebserviceCleanupSchedule
final Unit setWebserviceCleanupSchedule(String value)
-
getWebserviceVersionSchedule
final String getWebserviceVersionSchedule()
-
setWebserviceVersionSchedule
final Unit setWebserviceVersionSchedule(String value)
-
getWebserviceDatabaseCleanupSchedule
final String getWebserviceDatabaseCleanupSchedule()
-
setWebserviceDatabaseCleanupSchedule
final Unit setWebserviceDatabaseCleanupSchedule(String value)
-
getHomeDirectory
final File getHomeDirectory()
-
setHomeDirectory
final Unit setHomeDirectory(File value)
-
getServerPackCreatorPropertiesFile
final File getServerPackCreatorPropertiesFile()
-
getOverridesPropertiesFile
final File getOverridesPropertiesFile()
-
getDefaultConfig
final File getDefaultConfig()
-
getConfigsDirectory
final File getConfigsDirectory()
-
getTomcatBaseDirectory
final File getTomcatBaseDirectory()
-
setTomcatBaseDirectory
final Unit setTomcatBaseDirectory(File value)
-
getServerPacksDirectory
final File getServerPacksDirectory()
-
setServerPacksDirectory
final Unit setServerPacksDirectory(File value)
-
getLogsDirectory
final File getLogsDirectory()
-
getTomcatLogsDirectory
final File getTomcatLogsDirectory()
-
setTomcatLogsDirectory
final Unit setTomcatLogsDirectory(File value)
-
getManifestsDirectory
final File getManifestsDirectory()
-
getFabricIntermediariesManifest
final File getFabricIntermediariesManifest()
-
getLegacyFabricGameManifest
final File getLegacyFabricGameManifest()
-
getLegacyFabricLoaderManifest
final File getLegacyFabricLoaderManifest()
-
getLegacyFabricInstallerManifest
final File getLegacyFabricInstallerManifest()
-
getFabricInstallerManifest
final File getFabricInstallerManifest()
-
getQuiltVersionManifest
final File getQuiltVersionManifest()
-
getQuiltInstallerManifest
final File getQuiltInstallerManifest()
-
getForgeVersionManifest
final File getForgeVersionManifest()
-
getOldNeoForgeVersionManifest
final File getOldNeoForgeVersionManifest()
-
getNewNeoForgeVersionManifest
final File getNewNeoForgeVersionManifest()
-
getFabricVersionManifest
final File getFabricVersionManifest()
-
getMinecraftServerManifestsDirectory
final File getMinecraftServerManifestsDirectory()
-
getMinecraftVersionManifest
final File getMinecraftVersionManifest()
-
getWorkDirectory
final File getWorkDirectory()
-
getInstallerCacheDirectory
final File getInstallerCacheDirectory()
-
getTempDirectory
final File getTempDirectory()
-
getModpacksDirectory
final File getModpacksDirectory()
-
getServerFilesDirectory
final File getServerFilesDirectory()
-
getDefaultShellScriptTemplate
final File getDefaultShellScriptTemplate()
-
getDefaultPowerShellScriptTemplate
final File getDefaultPowerShellScriptTemplate()
-
getDefaultBatchScriptTemplate
final File getDefaultBatchScriptTemplate()
-
getDefaultJavaShellScriptTemplate
final File getDefaultJavaShellScriptTemplate()
-
getDefaultJavaPowerShellScriptTemplate
final File getDefaultJavaPowerShellScriptTemplate()
-
getDefaultJavaBatchScriptTemplate
final File getDefaultJavaBatchScriptTemplate()
-
getPropertiesDirectory
final File getPropertiesDirectory()
-
getIconsDirectory
final File getIconsDirectory()
-
getDefaultServerProperties
final File getDefaultServerProperties()
-
getDefaultServerIcon
final File getDefaultServerIcon()
-
getPluginsDirectory
final File getPluginsDirectory()
-
getPluginsConfigsDirectory
final File getPluginsConfigsDirectory()
-
getFallbackUpdated
final Boolean getFallbackUpdated()
-
getInstallLocationXml
final File getInstallLocationXml()
-
getLog4jXml
final File getLog4jXml()
-
getJarFolder
final File getJarFolder()
The folder containing the ServerPackCreator.exe or JAR-file.
- Returns:
Folder containing the ServerPackCreator.exe or JAR-file.
-
isExe
final Boolean isExe()
Whether a .exe or JAR-file was used for running ServerPackCreator.
- Returns:
trueif a .exe was/is used.
-
getJarFile
final File getJarFile()
The .exe or JAR-file of ServerPackCreator.
- Returns:
The .exe or JAR-file of ServerPackCreator.
-
getJarName
final String getJarName()
The name of the .exe or JAR-file.
- Returns:
The name of the .exe or JAR-file.
-
getJavaVersion
final String getJavaVersion()
The Java version used to run ServerPackCreator.
- Returns:
Java version.
-
getOSArch
final String getOSArch()
Architecture of the operating system on which ServerPackCreator is running on.
- Returns:
Arch.
-
getOSName
final String getOSName()
The name of the operating system on which ServerPackCreator is running on.
- Returns:
OS name.
-
getOSVersion
final String getOSVersion()
The version of the OS on which ServerPackCreator is running on.
- Returns:
Version of the OS.
-
getPreference
final Optional<String> getPreference(String pref, String def)
-
storePreference
final Unit storePreference(String pref, String value)
-
defaultScriptTemplates
@Deprecated(message = "Deprecated as of 6.0.0", replaceWith = @ReplaceWith(expression = "defaultScriptTemplateMap")) final List<File> defaultScriptTemplates()
Default list of script templates used by ServerPackCreator.
-
defaultStartScriptTemplates
final HashMap<String, String> defaultStartScriptTemplates()
Default map of start-script templates: sh, ps1, bat.
-
defaultJavaScriptTemplates
final HashMap<String, String> defaultJavaScriptTemplates()
Default map of start-script templates: sh, ps1, bat.
-
javaPath
final Optional<String> javaPath(Integer javaVersion)
Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience.
- Parameters:
javaVersion- The Java version to acquire the path for.- Returns:
The path to the Java executable/binary, if available.
-
javaPath
final Optional<String> javaPath(String javaVersion)
Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience.
- Parameters:
javaVersion- The Java version to acquire the path for.- Returns:
The path to the Java executable/binary, if available.
-
defaultWebserviceDatabase
final String defaultWebserviceDatabase()
-
defaultTomcatBaseDirectory
final File defaultTomcatBaseDirectory()
-
defaultServerPacksDirectory
final File defaultServerPacksDirectory()
-
defaultTomcatLogsDirectory
final File defaultTomcatLogsDirectory()
-
loadOverrides
final Unit loadOverrides(File properties)
-
loadProperties
final Unit loadProperties(Boolean saveProps)
Load properties using the default file path. Only call this method on an already initialized ApiProperties-object.
-
loadProperties
final Unit loadProperties(File propertiesFile, Boolean saveProps)
Reload from a specific properties-file.
- Parameters:
propertiesFile- The properties-file with which to loadProperties the settings and configuration.
-
acquireJavaPath
final String acquireJavaPath(String pathToJava)
Check the given path to a Java installation for validity and return it, if it is valid. If the passed path is a UNIX symlink or Windows lnk, it is resolved, then returned. If the passed path is considered invalid, the system default is acquired and returned.
- Parameters:
pathToJava- The path to check for whether it is a valid Java installation.- Returns:
Returns the path to the Java installation. If user input was incorrect, SPC will try to acquire the path automatically.
-
saveProperties
final Unit saveProperties(File propertiesFile)
Store the ApplicationProperties to disk, overwriting the existing one.
- Parameters:
propertiesFile- The file to store the properties to.
-
javaAvailable
final Boolean javaAvailable()
Whether a viable path to a Java executable or binary has been configured for ServerPackCreator.
- Returns:
trueif a viable path has been set.
-
changeLocale
final Unit changeLocale(Locale locale)
Writes the specified locale from -lang your_locale to a lang.properties file to ensure every subsequent start of serverpackcreator is executed using said locale.
- Parameters:
locale- The locale the user specified when they ran serverpackcreator with -lang -your_locale.
-
clientSideMods
final List<String> clientSideMods()
Acquire the default fallback list of clientside-only mods. If
de.griefed.serverpackcreator.serverpack.autodiscovery.filteris set to ExclusionFilter.REGEX, a regex fallback list is returned.- Returns:
The fallback list of clientside-only mods.
-
whitelistedMods
final List<String> whitelistedMods()
Acquire the default fallback list of whitelisted mods. If
de.griefed.serverpackcreator.serverpack.autodiscovery.filteris set to ExclusionFilter.REGEX, a regex fallback list is returned.- Returns:
The fallback list of whitelisted mods.
-
updateFallback
final Boolean updateFallback()
Update the fallback clientside-only mod-list of our
serverpackcreator.propertiesfrom the main-repository or one of its mirrors.- Returns:
trueif the fallback-property was updated.
-
storeCustomProperty
final String storeCustomProperty(String property, String value)
Store a custom property in the serverpackcreator.properties-file. Beware that every property you add receives a prefix, to prevent clashes with any other properties.
Said prefix consists of
custom.property.followed by the property you specified coming in last.Say you have a value in the property
saved, then the resulting property in the serverpackcreator.properties would be:custom.property.saved
-
retrieveCustomProperty
final String retrieveCustomProperty(String property)
Retrieve a custom property in the serverpackcreator.properties-file. Beware that every property you retrieve this way contains a prefix, to prevent clashes with any other properties.
Said prefix consists of
custom.property.followed by the property you specified coming in last.Say you have a property
saved, then the resulting property in the serverpackcreator.properties would be:custom.property.saved
-
setOldVersion
final Unit setOldVersion(String version)
Set the old version of ServerPackCreator used to perform necessary migrations between the old and the current version.
- Parameters:
version- Old version used before upgrading to the current version.
-
oldVersion
final String oldVersion()
Get the old version of ServerPackCreator used to perform necessary migrations between the old and the current version.
- Returns:
Old version used before updating. Empty if this is the first run of ServerPackCreator.
-
clearPropertyFileList
final Unit clearPropertyFileList()
-
getSupportedTypes
Array<String> getSupportedTypes()
-
getConfiguration
Configuration getConfiguration(LoggerContext loggerContext, ConfigurationSource source)
Depending on whether this is the first run of ServerPackCreator on a users machine, the default log4j2 configuration may be present at different locations. The default one is the config inside the home-directory of SPC, of which we will try to set up our logging with. If said file fails for whatever reason, we will try to use a config inside the directory from which SPC was executed. Should that fail, too, the config from the classpath is used, to ensure we always have default configs available. Should that fail, too, though, log4j is set up with its own default settings.
- Parameters:
loggerContext- logger context passed from log4j itselfsource- configuration source passed from log4j itself.- Returns:
Custom configuration with proper logs-directory set.
-
getSeparator
final static String getSeparator()
-
-
-
-