类 YamlConfiguration
- 所有已实现的接口:
Configuration,ConfigurationSection
Configuration 的一种实现, 所有文件以 Yaml 格式保存.
注意: 此实现不是线程安全的.-
字段概要
字段修饰符和类型字段说明protected static final String已过时。未使用, 不属于 APIprotected static final String已过时。未使用, 不属于 API从类继承的字段 org.bukkit.configuration.MemoryConfiguration
defaults, options从类继承的字段 org.bukkit.configuration.MemorySection
map -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static @NotNull YamlConfigurationloadConfiguration(@NotNull File file) 从给定文件创建并加载一个新的YamlConfiguration.static @NotNull YamlConfigurationloadConfiguration(@NotNull Reader reader) 从给定读取器创建并加载一个新的YamlConfiguration.voidloadFromString(@NotNull String contents) 从指定的字符串加载此FileConfiguration,而不是从文件加载.options()获取这个Configuration的ConfigurationOptions.将这个FileConfiguration转化为String对象并且返回从类继承的方法 org.bukkit.configuration.file.FileConfiguration
buildHeader, load, load, load, save, save从类继承的方法 org.bukkit.configuration.MemoryConfiguration
addDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaults从类继承的方法 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, toString从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait从接口继承的方法 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
-
字段详细资料
-
构造器详细资料
-
YamlConfiguration
public YamlConfiguration()
-
-
方法详细资料
-
saveToString
从类复制的说明:FileConfiguration将这个FileConfiguration转化为String对象并且返回- 指定者:
saveToString在类中FileConfiguration- 返回:
- 这个FileConfiguration包含的所有String
-
loadFromString
从类复制的说明:FileConfiguration从指定的字符串加载此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.
- 指定者:
loadFromString在类中FileConfiguration- 参数:
contents- 要加载的配置内容- 抛出:
InvalidConfigurationException- 如果指定的字符串无效则抛出
-
options
从接口复制的说明:Configuration获取这个Configuration的ConfigurationOptions.如需修改配置,直接修改返回值即可.
原文: Gets the
ConfigurationOptionsfor thisConfiguration.All setters through this method are chainable.
- 指定者:
options在接口中Configuration- 覆盖:
options在类中FileConfiguration- 返回:
- 这个配置文件的一些配置(格式之类的).
-
loadConfiguration
从给定文件创建并加载一个新的YamlConfiguration.加载配置时的任何错误将被记录然后忽略. 如果指定的输入不是有效的配置, 将返回一个空白配置.
使用的编码可能遵循系统相关的默认值.
原文: 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.
The encoding used may follow the system dependent default.
- 参数:
file- 输入文件.- 返回:
- 生成的配置.
- 抛出:
IllegalArgumentException- 如果 file 为 null 则抛出此异常.
-
loadConfiguration
@NotNull public static @NotNull YamlConfiguration loadConfiguration(@NotNull @NotNull Reader reader) 从给定读取器创建并加载一个新的YamlConfiguration.加载配置时的任何错误将被记录然后忽略. 如果指定的输入不是有效的配置, 将返回一个空白配置.
原文: Creates a new
YamlConfiguration, loading from the given reader.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.
- 参数:
reader- 输入读取器.- 返回:
- 生成的配置.
- 抛出:
IllegalArgumentException- 如果流为 null 则抛出此异常.
-