Package de.themoep.utils.lang
Class LanguageConfig<C>
java.lang.Object
de.themoep.utils.lang.LanguageConfig<C>
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLanguageConfig(String resourceFolder, File configFile, String locale) protectedLanguageConfig(String resourceFolder, File configFile, String locale, boolean saveFile) -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanCheck if the config contains a certain keyabstract booleanCheck if the config contains a certain keyabstract StringGet a string from the config by its keyGet a string from the config by its keyGet a string from the config by its keyGet the locale that this language config is forabstract CGet the raw config objectabstract voidLoad the config from the file systemabstract booleanSave the default config resource from the jar file to the file systemvoidsetDefaults(LanguageConfig<? extends C> defaults) Set the default config of this config
-
Field Details
-
resourcePath
-
configFile
-
saveFile
protected final boolean saveFile -
config
-
defaultConfig
-
-
Constructor Details
-
LanguageConfig
-
LanguageConfig
-
-
Method Details
-
loadConfig
public abstract void loadConfig()Load the config from the file system -
saveConfigResource
public abstract boolean saveConfigResource()Save the default config resource from the jar file to the file system- Returns:
- Whether or not the file was saved. If it already existed this will return false
-
contains
Check if the config contains a certain key- Parameters:
key- The key of the string- Returns:
trueif this config (and not the defaults) has this key,falseif not
-
contains
Check if the config contains a certain key- Parameters:
key- The key of the stringcheckDefault- Whether or not to check the default config- Returns:
trueif this config (and the default) has this key,falseif not
-
get
Get a string from the config by its key- Parameters:
key- The key of the string- Returns:
- The message or an error message if it doesn't exist; never null! (use
contains(String)to check existance)
-
getRawConfig
Get the raw config object- Returns:
- The raw config object
-
get
Get a string from the config by its key- Parameters:
key- The key of the stringreplacements- What to replace the placeholders with. The n-th index is the placeholder, the n+1-th the value.- Returns:
- The message with the placeholders replaced
-
get
Get a string from the config by its key- Parameters:
key- The key of the stringreplacements- What to replace the placeholders with- Returns:
- The message with the placeholders replaced
-
getLocale
Get the locale that this language config is for- Returns:
- The string representation of the locale of this config
-
setDefaults
Set the default config of this config- Parameters:
defaults- The default or config or null if it should not have one
-