org.bukkit.configuration.file
Class YamlConfiguration
java.lang.Object
org.bukkit.configuration.MemorySection
org.bukkit.configuration.MemoryConfiguration
org.bukkit.configuration.file.FileConfiguration
org.bukkit.configuration.file.YamlConfiguration
- All Implemented Interfaces:
- Configuration, ConfigurationSection
public class YamlConfiguration
- extends FileConfiguration
An implementation of Configuration
which saves all files in Yaml.
Note that this implementation is not synchronized.
Methods inherited from class org.bukkit.configuration.MemorySection |
contains, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getOfflinePlayer, getOfflinePlayer, getRoot, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLong, isOfflinePlayer, isPrimitiveWrapper, isSet, isString, isVector, mapChildrenKeys, mapChildrenValues, set, toString |
Methods inherited from interface org.bukkit.configuration.ConfigurationSection |
contains, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getOfflinePlayer, getOfflinePlayer, getRoot, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLong, isOfflinePlayer, isSet, isString, isVector, set |
COMMENT_PREFIX
protected static final String COMMENT_PREFIX
- See Also:
- Constant Field Values
BLANK_CONFIG
protected static final String BLANK_CONFIG
- See Also:
- Constant Field Values
YamlConfiguration
public YamlConfiguration()
saveToString
public String saveToString()
- Description copied from class:
FileConfiguration
- Saves this
FileConfiguration
to a string, and returns it.
- Specified by:
saveToString
in class FileConfiguration
- Returns:
- String containing this configuration.
loadFromString
public void loadFromString(String contents)
throws InvalidConfigurationException
- Description copied from class:
FileConfiguration
- Loads 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:
loadFromString
in class FileConfiguration
- Parameters:
contents
- Contents of a Configuration to load.
- Throws:
InvalidConfigurationException
- Thrown if the specified string is invalid.
convertMapsToSections
protected void convertMapsToSections(Map<?,?> input,
ConfigurationSection section)
parseHeader
protected String parseHeader(String input)
buildHeader
protected String buildHeader()
- Description copied from class:
FileConfiguration
- Compiles the header for this
FileConfiguration
and returns the result.
This will use the header from FileConfiguration.options()
-> FileConfigurationOptions.header()
,
respecting the rules of FileConfigurationOptions.copyHeader()
if set.
- Specified by:
buildHeader
in class FileConfiguration
- Returns:
- Compiled header
options
public YamlConfigurationOptions options()
- Description copied from interface:
Configuration
- Gets the
ConfigurationOptions
for this Configuration
.
All setters through this method are chainable.
- Specified by:
options
in interface Configuration
- Overrides:
options
in class FileConfiguration
- Returns:
- Options for this configuration
loadConfiguration
public static YamlConfiguration loadConfiguration(File file)
- Creates a new
YamlConfiguration
, 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.
- Parameters:
file
- Input file
- Returns:
- Resulting configuration
- Throws:
IllegalArgumentException
- Thrown if file is null
loadConfiguration
public static YamlConfiguration loadConfiguration(InputStream stream)
- Creates a new
YamlConfiguration
, loading from the given stream.
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.
- Parameters:
stream
- Input stream
- Returns:
- Resulting configuration
- Throws:
IllegalArgumentException
- Thrown if stream is null
Copyright © 2013. All Rights Reserved.