Class YamlConfiguration
java.lang.Object
com.plotsquared.core.configuration.MemorySection
com.plotsquared.core.configuration.MemoryConfiguration
com.plotsquared.core.configuration.file.FileConfiguration
com.plotsquared.core.configuration.file.YamlConfiguration
- All Implemented Interfaces:
Configuration,ConfigurationSection
An implementation of
Configuration which saves all files in Yaml.
Note that this implementation is not synchronized.-
Field Summary
Fields inherited from class com.plotsquared.core.configuration.MemoryConfiguration
defaults, optionsFields inherited from class com.plotsquared.core.configuration.MemorySection
map -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringCompiles the header for this FileConfiguration and returns the result.protected voidconvertMapsToSections(Map<?, ?> input, ConfigurationSection section) static YamlConfigurationloadConfiguration(File file) Creates a newYamlConfiguration, loading from the given file.voidloadFromString(String contents) Loads this FileConfiguration from the specified string, as opposed to from file.options()Gets theConfigurationOptionsfor thisConfiguration.protected StringparseHeader(String input) Saves this FileConfiguration to a string, and returns it.Methods inherited from class com.plotsquared.core.configuration.file.FileConfiguration
load, load, saveMethods inherited from class com.plotsquared.core.configuration.MemoryConfiguration
addDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaultsMethods inherited from class com.plotsquared.core.configuration.MemorySection
contains, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getRoot, getShortList, getString, getString, getStringList, getValues, isBoolean, isConfigurationSection, isDouble, isInt, isList, isLong, isPrimitiveWrapper, isSet, isString, mapChildrenKeys, mapChildrenValues, set, toDouble, toInt, toLong, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.plotsquared.core.configuration.ConfigurationSection
contains, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getRoot, getShortList, getString, getString, getStringList, getValues, isBoolean, isConfigurationSection, isDouble, isInt, isList, isLong, isSet, isString, set
-
Constructor Details
-
YamlConfiguration
public YamlConfiguration()
-
-
Method Details
-
loadConfiguration
Creates a newYamlConfiguration, loading from the given file.Any errors loading the Configuration will be logged and then ignored. If the specified input is not a valid config, a blank config will be returned.
The encoding used may follow the system dependent default.
- Parameters:
file- Input file- Returns:
- Resulting configuration
-
saveToString
Description copied from class:FileConfigurationSaves this FileConfiguration to a string, and returns it.- Specified by:
saveToStringin classFileConfiguration- Returns:
- String containing this configuration.
-
loadFromString
Description copied from class:FileConfigurationLoads this FileConfiguration from the specified string, as opposed to from file.All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given string.
If the string is invalid in any way, an exception will be thrown.
- Specified by:
loadFromStringin classFileConfiguration- Parameters:
contents- Contents of a Configuration to load.- Throws:
InvalidConfigurationException- Thrown if the specified string is invalid.
-
convertMapsToSections
-
parseHeader
-
buildHeader
Description copied from class:FileConfigurationCompiles the header for this FileConfiguration and returns the result.This will use the header from
FileConfiguration.options()->FileConfigurationOptions.header(), respecting the rules ofFileConfigurationOptions.copyHeader()if set.- Specified by:
buildHeaderin classFileConfiguration- Returns:
- Compiled header
-
options
Description copied from interface:ConfigurationGets theConfigurationOptionsfor thisConfiguration.All setters through this method are chainable.
- Specified by:
optionsin interfaceConfiguration- Overrides:
optionsin classFileConfiguration- Returns:
- Options for this configuration
-