Interface Configuration
- All Superinterfaces:
ConfigurationSection
- All Known Implementing Classes:
FileConfiguration
,MemoryConfiguration
,YamlConfiguration
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDefault
(@NotNull String path, @Nullable Object value) Sets the default value of the given path as provided.void
addDefaults
(@NotNull Map<String, Object> defaults) Sets the default values of the given paths as provided.void
addDefaults
(@NotNull Configuration defaults) Sets the default values of the given paths as provided.Gets the sourceConfiguration
for this configuration.options()
Gets theConfigurationOptions
for thisConfiguration
.void
setDefaults
(@NotNull Configuration defaults) Sets the source of all default values for thisConfiguration
.Methods inherited from interface org.bukkit.configuration.ConfigurationSection
contains, contains, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getComments, getComponent, getComponent, 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, getParent, getRichMessage, getRichMessage, 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, setComponent, setInlineComments, setRichMessage
-
Method Details
-
addDefault
Sets the default value of the given path as provided.If no source
Configuration
was provided as a default collection, then a newMemoryConfiguration
will be created to hold the new default value.If value is null, the value will be removed from the default Configuration source.
- Specified by:
addDefault
in interfaceConfigurationSection
- Parameters:
path
- Path of the value to set.value
- Value to set the default to.- Throws:
IllegalArgumentException
- Thrown if path is null.
-
addDefaults
Sets the default values of the given paths as provided.If no source
Configuration
was provided as a default collection, then a newMemoryConfiguration
will be created to hold the new default values.- Parameters:
defaults
- A map of Path->Values to add to defaults.- Throws:
IllegalArgumentException
- Thrown if defaults is null.
-
addDefaults
Sets the default values of the given paths as provided.If no source
Configuration
was provided as a default collection, then a newMemoryConfiguration
will 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
setDefaults(org.bukkit.configuration.Configuration)
.- Parameters:
defaults
- A configuration holding a list of defaults to copy.- Throws:
IllegalArgumentException
- Thrown if defaults is null or this.
-
setDefaults
Sets 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.
- Parameters:
defaults
- New source of default values for this configuration.- Throws:
IllegalArgumentException
- Thrown if defaults is null or this.
-
getDefaults
Gets the sourceConfiguration
for this configuration.If no configuration source was set, but default values were added, then a
MemoryConfiguration
will be returned. If no source was set and no defaults were set, then this method will return null.- Returns:
- Configuration source for default values, or null if none exist.
-
options
Gets theConfigurationOptions
for thisConfiguration
.All setters through this method are chainable.
- Returns:
- Options for this configuration
-