Class MemoryConfiguration
- All Implemented Interfaces:
Configuration,ConfigurationSection
- Direct Known Subclasses:
FileConfiguration
Configuration implementation that does not save or load
from any source, and stores all values in memory only.
This is useful for temporary Configurations for providing defaults.-
Field Summary
FieldsFields inherited from class org.bukkit.configuration.MemorySection
map -
Constructor Summary
ConstructorsConstructorDescriptionCreates an emptyMemoryConfigurationwith no default values.MemoryConfiguration(Configuration defaults) Creates an emptyMemoryConfigurationusing the specifiedConfigurationas a source for all default values. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDefault(String path, Object value) Sets the default value in the root at the given path as provided.voidaddDefaults(Map<String, Object> defaults) Sets the default values of the given paths as provided.voidaddDefaults(Configuration defaults) Sets the default values of the given paths as provided.Gets the sourceConfigurationfor this configuration.Gets the parentConfigurationSectionthat directly contains thisConfigurationSection.options()Gets theConfigurationOptionsfor thisConfiguration.voidsetDefaults(Configuration defaults) Sets the source of all default values for thisConfiguration.Methods inherited from class org.bukkit.configuration.MemorySection
contains, contains, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getComments, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInlineComments, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLocation, getLocation, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getOfflinePlayer, getOfflinePlayer, getRoot, getSerializable, getSerializable, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLocation, isLong, isOfflinePlayer, isPrimitiveWrapper, isSet, isString, isVector, mapChildrenKeys, mapChildrenValues, set, setComments, setInlineComments, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bukkit.configuration.ConfigurationSection
contains, contains, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getComments, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInlineComments, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLocation, getLocation, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getOfflinePlayer, getOfflinePlayer, getRoot, getSerializable, getSerializable, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLocation, isLong, isOfflinePlayer, isSet, isString, isVector, set, setComments, setInlineComments
-
Field Details
-
defaults
-
options
-
-
Constructor Details
-
MemoryConfiguration
public MemoryConfiguration()Creates an emptyMemoryConfigurationwith no default values. -
MemoryConfiguration
Creates an emptyMemoryConfigurationusing the specifiedConfigurationas a source for all default values.- Parameters:
defaults- Default value provider- Throws:
IllegalArgumentException- Thrown if defaults is null
-
-
Method Details
-
addDefault
Description copied from interface:ConfigurationSectionSets the default value in the root at the given path as provided.If no source
Configurationwas provided as a default collection, then a newMemoryConfigurationwill be created to hold the new default value.If value is null, the value will be removed from the default Configuration source.
If the value as returned by
ConfigurationSection.getDefaultSection()is null, then this will create a new section at the path, replacing anything that may have existed there previously.- Specified by:
addDefaultin interfaceConfiguration- Specified by:
addDefaultin interfaceConfigurationSection- Overrides:
addDefaultin classMemorySection- Parameters:
path- Path of the value to set.value- Value to set the default to.
-
addDefaults
Description copied from interface:ConfigurationSets the default values of the given paths as provided.If no source
Configurationwas provided as a default collection, then a newMemoryConfigurationwill be created to hold the new default values.- Specified by:
addDefaultsin interfaceConfiguration- Parameters:
defaults- A map of Path->Values to add to defaults.
-
addDefaults
Description copied from interface:ConfigurationSets the default values of the given paths as provided.If no source
Configurationwas provided as a default collection, then a newMemoryConfigurationwill be created to hold the new default value.This method will not hold a reference to the specified Configuration, nor will it automatically update if that Configuration ever changes. If you require this, you should set the default source with
Configuration.setDefaults(org.bukkit.configuration.Configuration).- Specified by:
addDefaultsin interfaceConfiguration- Parameters:
defaults- A configuration holding a list of defaults to copy.
-
setDefaults
Description copied from interface:ConfigurationSets the source of all default values for thisConfiguration.If a previous source was set, or previous default values were defined, then they will not be copied to the new source.
- Specified by:
setDefaultsin interfaceConfiguration- Parameters:
defaults- New source of default values for this configuration.
-
getDefaults
Description copied from interface:ConfigurationGets the sourceConfigurationfor this configuration.If no configuration source was set, but default values were added, then a
MemoryConfigurationwill be returned. If no source was set and no defaults were set, then this method will return null.- Specified by:
getDefaultsin interfaceConfiguration- Returns:
- Configuration source for default values, or null if none exist.
-
getParent
Description copied from interface:ConfigurationSectionGets the parentConfigurationSectionthat directly contains thisConfigurationSection.For any
Configurationthemselves, this will return null.If the section is no longer contained within its parent for any reason, such as being replaced with a different value, this may return null.
- Specified by:
getParentin interfaceConfigurationSection- Overrides:
getParentin classMemorySection- Returns:
- Parent section containing this section.
-
options
Description copied from interface:ConfigurationGets theConfigurationOptionsfor thisConfiguration.All setters through this method are chainable.
- Specified by:
optionsin interfaceConfiguration- Returns:
- Options for this configuration
-