Package de.themoep.utils.lang
Class LanguageConfig<C>
java.lang.Object
de.themoep.utils.lang.LanguageConfig<C>
- Direct Known Subclasses:
BukkitLanguageConfig
,BungeeLanguageConfig
,SimpleLanguageConfig
,SpongeLanguageConfig
,VelocityLanguageConfig
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
LanguageConfig
(String resourceFolder, File configFile, String locale) protected
LanguageConfig
(String resourceFolder, File configFile, String locale, boolean saveFile) -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
Check if the config contains a certain keyabstract boolean
Check if the config contains a certain keyabstract String
Get 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 C
Get the raw config objectabstract void
Load the config from the file systemabstract boolean
Save the default config resource from the jar file to the file systemvoid
setDefaults
(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:
true
if this config (and not the defaults) has this key,false
if 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:
true
if this config (and the default) has this key,false
if 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
-