public class MemoryConfiguration extends MemorySection implements Configuration
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.| 限定符和类型 | 字段和说明 |
|---|---|
protected Configuration |
defaults |
protected MemoryConfigurationOptions |
options |
map| 构造器和说明 |
|---|
MemoryConfiguration()
Creates an empty
MemoryConfiguration with no default values. |
MemoryConfiguration(Configuration defaults)
Creates an empty
MemoryConfiguration using the specified Configuration as a source for all default values. |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addDefault(java.lang.String path,
java.lang.Object value)
给指定路径添加一个缺省值.
|
void |
addDefaults(Configuration defaults)
把
Configuration 全部加入到缺省值列表. |
void |
addDefaults(java.util.Map<java.lang.String,java.lang.Object> defaults)
把map里面的键值都加入到缺省值列表.
|
Configuration |
getDefaults()
获取这个
Configuration 的缺省值 Configuration. |
ConfigurationSection |
getParent()
Gets the parent
ConfigurationSection that directly contains this ConfigurationSection. |
MemoryConfigurationOptions |
options()
获取这个
Configuration 的 ConfigurationOptions. |
void |
setDefaults(Configuration defaults)
设置新的缺省值列表.
|
contains, 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, getSerializable, getSerializable, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLong, isOfflinePlayer, isPrimitiveWrapper, isSet, isString, isVector, mapChildrenKeys, mapChildrenValues, set, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, 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, getSerializable, getSerializable, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLong, isOfflinePlayer, isSet, isString, isVector, setprotected Configuration defaults
protected MemoryConfigurationOptions options
public MemoryConfiguration()
MemoryConfiguration with no default values.public MemoryConfiguration(Configuration defaults)
MemoryConfiguration using the specified Configuration as a source for all default values.defaults - Default value providerjava.lang.IllegalArgumentException - Thrown if defaults is nullpublic void addDefault(java.lang.String path,
java.lang.Object value)
ConfigurationSection
如果缺省值 Configuration 没有被提供, 则自动创建一个新的.
如果值为 null, 表示从缺省值 Configuration 中删除这个路径上的默认值
如果 ConfigurationSection.getDefaultSection() 返回的值为 null, 则建立一个新的
原文: Sets the default value in the root at the given path as provided.
If no source Configuration was provided as a default collection, then a new MemoryConfiguration will 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.
addDefault 在接口中 ConfigurationaddDefault 在接口中 ConfigurationSectionaddDefault 在类中 MemorySectionpath - 要设置缺省值的路径.value - 要设置的值.public void addDefaults(java.util.Map<java.lang.String,java.lang.Object> defaults)
Configuration
如果没有缺省值 Configuration, 那么将会建立一个新的缺省值 MemoryConfiguration 用于保存.
如果值为 null , 将会删除该路径上的缺省值.
原文: Sets the default values of the given paths as provided.
If no source Configuration was provided as a default collection, then a new MemoryConfiguration will be created to hold the new default values.
addDefaults 在接口中 Configurationdefaults - Map 的键是路径, 值是对应路径的值.public void addDefaults(Configuration defaults)
ConfigurationConfiguration 全部加入到缺省值列表.
如果没有缺省值 Configuration, 那么将会建立一个新的 MemoryConfiguration 用于保存.
你可以使用Configuration.setDefaults(org.bukkit.configuration.Configuration)来设置缺省值列表来源.
原文: Sets the default values of the given paths as provided.
If no source Configuration was provided as a default collection, then a new MemoryConfiguration will be created to hold the new default value.
If you require this, you should set the default source with Configuration.setDefaults(org.bukkit.configuration.Configuration).
addDefaults 在接口中 Configurationdefaults - A configuration holding a list of defaults to copy.public void setDefaults(Configuration defaults)
Configuration将直接替换原有的缺省值列表(如果有).
原文:
Sets the source of all default values for this Configuration.
If a previous source was set, or previous default values were defined, then they will not be copied to the new source.
setDefaults 在接口中 Configurationdefaults - 新的 Configuration .public Configuration getDefaults()
ConfigurationConfiguration 的缺省值 Configuration.
如果设置过缺省值, 即使没有设置缺省值列表, 也会返回 Configuration.
如果都没有, 则返回 null.
原文:
Gets the source Configuration 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.
getDefaults 在接口中 Configurationpublic ConfigurationSection getParent()
ConfigurationSectionConfigurationSection that directly contains this ConfigurationSection.
For any Configuration themselves, 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.
getParent 在接口中 ConfigurationSectiongetParent 在类中 MemorySectionpublic MemoryConfigurationOptions options()
ConfigurationConfiguration 的 ConfigurationOptions.
如需修改配置,直接修改返回值即可.
原文:
Gets the ConfigurationOptions for this Configuration.
All setters through this method are chainable.
options 在接口中 Configuration