public interface ConfigurationSection
Configuration
的基类.
所有用于扩展配置文件读取的类都应当实现以下方法.
Represents a section of a Configuration
限定符和类型 | 方法和说明 |
---|---|
void |
addDefault(java.lang.String path,
java.lang.Object value)
给指定路径添加一个缺省值.
|
boolean |
contains(java.lang.String path)
检查
ConfigurationSection 是否包含指定路径. |
boolean |
contains(java.lang.String path,
boolean ignoreDefault)
Checks if this
ConfigurationSection contains the given path. |
ConfigurationSection |
createSection(java.lang.String path)
Creates an empty
ConfigurationSection at the specified path. |
ConfigurationSection |
createSection(java.lang.String path,
java.util.Map<?,?> map)
Creates a
ConfigurationSection at the specified path, with specified values. |
java.lang.Object |
get(java.lang.String path)
在指定路径获取一个 Object 类型的值.
|
java.lang.Object |
get(java.lang.String path,
java.lang.Object def)
在指定路径上获取一个 Object , 如果无法获取, 则直接返回默认值.
|
boolean |
getBoolean(java.lang.String path)
在指定路径获取一个 boolean 类型的值.
|
boolean |
getBoolean(java.lang.String path,
boolean def)
在指定路径上获取一个 boolean, 如果无法获取, 则直接返回默认值.
|
java.util.List<java.lang.Boolean> |
getBooleanList(java.lang.String path)
在指定路径获取一个 List<Boolean>.
|
java.util.List<java.lang.Byte> |
getByteList(java.lang.String path)
在指定路径获取一个 List<Byte>.
|
java.util.List<java.lang.Character> |
getCharacterList(java.lang.String path)
在指定路径获取一个 List<Character>.
|
Color |
getColor(java.lang.String path)
在指定路径获取一个Color类型的值.
|
Color |
getColor(java.lang.String path,
Color def)
在指定路径上获取一个
Color , 如果无法获取, 则直接返回指定默认值. |
ConfigurationSection |
getConfigurationSection(java.lang.String path)
获取一个
ConfigurationSection ,它是一个以指定路径作为基点的新的配置项,修改会同步. |
java.lang.String |
getCurrentPath()
从根
Configuration 中获取这个 ConfigurationSection 的路径. |
ConfigurationSection |
getDefaultSection()
|
double |
getDouble(java.lang.String path)
在指定路径获取一个 double 类型的值.
|
double |
getDouble(java.lang.String path,
double def)
在指定路径上获取一个double, 如果无法获取, 则直接返回默认值.
|
java.util.List<java.lang.Double> |
getDoubleList(java.lang.String path)
在指定路径获取一个 List<Double>.
|
java.util.List<java.lang.Float> |
getFloatList(java.lang.String path)
在指定路径获取一个 List<Float>.
|
int |
getInt(java.lang.String path)
在指定路径获取一个 int 类型的值.
|
int |
getInt(java.lang.String path,
int def)
在指定路径上获取一个 int, 如果无法获取, 则直接返回默认值.
|
java.util.List<java.lang.Integer> |
getIntegerList(java.lang.String path)
在指定路径获取一个 List<Integer>.
|
ItemStack |
getItemStack(java.lang.String path)
在指定路径获取一个
ItemStack 类型的值. |
ItemStack |
getItemStack(java.lang.String path,
ItemStack def)
在指定路径上获取一个
ItemStack , 如果无法获取, 则直接返回默认值. |
java.util.Set<java.lang.String> |
getKeys(boolean deep)
获取此配置文件的键集合.
|
java.util.List<?> |
getList(java.lang.String path)
在指定路径获取一个 List 类型的值.
|
java.util.List<?> |
getList(java.lang.String path,
java.util.List<?> def)
在指定路径上获取一个 List, 如果无法获取, 则直接返回默认值.
|
long |
getLong(java.lang.String path)
在指定路径获取一个 long 类型的值.
|
long |
getLong(java.lang.String path,
long def)
在指定路径上获取一个 long, 如果无法获取, 则直接返回默认值.
|
java.util.List<java.lang.Long> |
getLongList(java.lang.String path)
在指定路径获取一个 List<Long>.
|
java.util.List<java.util.Map<?,?>> |
getMapList(java.lang.String path)
在指定路径获取一个 List<Maps>.
|
java.lang.String |
getName()
Gets the name of this individual
ConfigurationSection , in the path. |
OfflinePlayer |
getOfflinePlayer(java.lang.String path)
在指定路径获取一个
OfflinePlayer 类型的值. |
OfflinePlayer |
getOfflinePlayer(java.lang.String path,
OfflinePlayer def)
在指定路径上获取一个
OfflinePlayer , 如果无法获取, 则直接返回默认值. |
ConfigurationSection |
getParent()
Gets the parent
ConfigurationSection that directly contains this ConfigurationSection . |
Configuration |
getRoot()
Gets the root
Configuration that contains this ConfigurationSection
For any Configuration themselves, this will return its own object. |
<T extends ConfigurationSerializable> |
getSerializable(java.lang.String path,
java.lang.Class<T> clazz)
Gets the requested
ConfigurationSerializable object at the given
path. |
<T extends ConfigurationSerializable> |
getSerializable(java.lang.String path,
java.lang.Class<T> clazz,
T def)
Gets the requested
ConfigurationSerializable object at the given
path, returning a default value if not found
If the Object does not exist then the specified default value will
returned regardless of if a default has been identified in the root
Configuration . |
java.util.List<java.lang.Short> |
getShortList(java.lang.String path)
在指定路径获取一个 List<Short>.
|
java.lang.String |
getString(java.lang.String path)
在指定路径获取一个 String 类型的值.
|
java.lang.String |
getString(java.lang.String path,
java.lang.String def)
在指定路径上获取一个 String , 如果无法获取, 则直接返回默认值.
|
java.util.List<java.lang.String> |
getStringList(java.lang.String path)
在指定路径获取一个 List<String>.
|
java.util.Map<java.lang.String,java.lang.Object> |
getValues(boolean deep)
获取这个配置文件的键值集合.
|
Vector |
getVector(java.lang.String path)
在指定路径获取一个Vector类型的值.
|
Vector |
getVector(java.lang.String path,
Vector def)
在指定路径上获取一个
Vector , 如果无法获取, 则直接返回默认值. |
boolean |
isBoolean(java.lang.String path)
检查指定路径是否是 boolean.
|
boolean |
isColor(java.lang.String path)
检查指定路径是否是
Color . |
boolean |
isConfigurationSection(java.lang.String path)
检查指定路径是否是
ConfigurationSection . |
boolean |
isDouble(java.lang.String path)
检查指定路径是否是 double.
|
boolean |
isInt(java.lang.String path)
检查指定路径是否是 int.
|
boolean |
isItemStack(java.lang.String path)
检查指定路径是否是
ItemStack . |
boolean |
isList(java.lang.String path)
检查指定路径是否是 List.
|
boolean |
isLong(java.lang.String path)
检查指定路径是否是 long.
|
boolean |
isOfflinePlayer(java.lang.String path)
检查指定路径是否是
OfflinePlayer . |
boolean |
isSet(java.lang.String path)
检查指定路径是否是 Set.
|
boolean |
isString(java.lang.String path)
检查指定路径是否是 String.
|
boolean |
isVector(java.lang.String path)
检查指定路径是否是
Vector . |
void |
set(java.lang.String path,
java.lang.Object value)
Sets the specified path to the given value.
|
java.util.Set<java.lang.String> getKeys(boolean deep)
如果为 true, 则返回包括所有的能访问到的键的集合. 类似于获取硬盘中第一层目录还是遍历全部子目录.
例如:
top1. Second1
top1. Second2
top2. Second1
top2. Second2
原文: Gets a set containing all keys in this section.
If deep is set to true, then this will contain all the keys within any child ConfigurationSection
s (and their children, etc).
These will be in a valid path notation for you to use.
If deep is set to false, then this will contain only the keys of any direct children, and not their own children.
deep
- 获取全部键, 或者仅仅获取表层键.java.util.Map<java.lang.String,java.lang.Object> getValues(boolean deep)
如果为 true, 则返回包括所有的能访问到的键和值的集合. 类似于获取硬盘中第一层目录还是遍历全部子目录.
如果为 false, 则返回表层的键和值的集合.
原文: Gets a Map containing all keys and their values for this section.
If deep is set to true, then this will contain all the keys and values within any child ConfigurationSection
s (and their children, etc).
These keys will be in a valid path notation for you to use.
If deep is set to false, then this will contain only the keys and values of any direct children, and not their own children.
deep
- 获取全部键值集合(true), 或者仅仅获取表层键值集合(false).boolean contains(java.lang.String path)
ConfigurationSection
是否包含指定路径.
如果这个路径不存在, 但已指定一个缺省值, 也将返回 true.
原文:
Checks if this ConfigurationSection
contains the given path.
If the value for the requested path does not exist but a default value has been specified, this will return true.
path
- 要检查的路径java.lang.IllegalArgumentException
- 如果路径是 null 时抛出此异常.boolean contains(java.lang.String path, boolean ignoreDefault)
ConfigurationSection
contains the given path.
If the value for the requested path does not exist, the boolean parameter of true has been specified, a default value for the path exists, this will return true.
If a boolean parameter of false has been specified, true will only be returned if there is a set value for the specified path.
path
- Path to check for existence.ignoreDefault
- Whether or not to ignore if a default value for the
specified path exists.java.lang.IllegalArgumentException
- Thrown when path is null.boolean isSet(java.lang.String path)
如果路径存在, 但不是 Set, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文:
Checks if this ConfigurationSection
has a value set for the given path.
If the value for the requested path does not exist but a default value has been specified, this will still return false.
path
- 检查路径.java.lang.IllegalArgumentException
- 如果路径为 null 则会抛出此异常.java.lang.String getCurrentPath()
Configuration
中获取这个 ConfigurationSection
的路径.
如果这个 ConfigurationSection
已经是根目录, 将返回一个空字符串.
如果这个 ConfigurationSection
不属于任何根目录, 将返回 null.
如果要获取这个 ConfigurationSection
名字,也就是路径中的最后一节, 你应该使用 getName()
来获取.
原文:
Gets the path of this ConfigurationSection
from its root Configuration
.
For any Configuration
themselves, this will return an empty string.
If the section is no longer contained within its root for any reason, such as being replaced with a different value, this may return null.
To retrieve the single name of this section, that is, the final part of the path returned by this method, you may use getName()
.
java.lang.String getName()
ConfigurationSection
, in the path.
This will always be the final part of getCurrentPath()
, unless the section is orphaned.
Configuration getRoot()
Configuration
that contains this ConfigurationSection
For any Configuration
themselves, this will return its own object.
If the section is no longer contained within its root for any reason, such as being replaced with a different value, this may return null.
ConfigurationSection getParent()
ConfigurationSection
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.
java.lang.Object get(java.lang.String path)
如果这个 Object 不存在, 但已指定一个缺省值, 这将返回缺省值.
如果这个 Object 不存在, 并且没有指定缺省值, 则返回 null.
原文: Gets the requested Object by path.
If the Object does not exist but a default value has been specified, this will return the default value. If the Object does not exist and no default value was specified, this will return null.
path
- 获取 Object 的路径.java.lang.Object get(java.lang.String path, java.lang.Object def)
如果 Object 无法在 Configuration
中被获取, 则不会尝试去缺省列表中去寻找, 而是直接返回指定的默认值.
原文: Gets the requested Object by path, returning a default value if not found.
If the Object does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
path
- 获取 Object 的路径.def
- 当指定路径上没有值, 返回这个值.void set(java.lang.String path, java.lang.Object value)
If value is null, the entry will be removed. Any existing entry will be replaced, regardless of what the new value is.
Some implementations may have limitations on what you may store.
See their individual javadocs for details.
No implementations should allow you to store Configuration
s or ConfigurationSection
s, please use createSection(java.lang.String)
for that.
path
- Path of the object to set.value
- New value to set the path to.ConfigurationSection createSection(java.lang.String path)
ConfigurationSection
at the specified path.
Any value that was previously set at this path will be overwritten.
If the previous value was itself a ConfigurationSection
, it will be orphaned.
path
- Path to create the section at.ConfigurationSection createSection(java.lang.String path, java.util.Map<?,?> map)
ConfigurationSection
at the specified path, with specified values.
Any value that was previously set at this path will be overwritten.
If the previous value was itself a ConfigurationSection
, it will be orphaned.
path
- Path to create the section at.map
- The values to used.java.lang.String getString(java.lang.String path)
如果这个 String 不存在, 但已指定一个缺省值, 这将返回缺省值.
如果这个 String 不存在, 并且没有指定缺省值, 则返回 null.
原文: Gets the requested String by path.
If the String does not exist but a default value has been specified, this will return the default value. If the String does not exist and no default value was specified, this will return null.
path
- 获取 String 的路径.java.lang.String getString(java.lang.String path, java.lang.String def)
如果无法获取到一个 String, 将不会尝试去缺省列表中去获取, 而是直接返回指定的默认值.
原文: Gets the requested String by path, returning a default value if not found.
If the String does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
path
- 获取 String 的路径.def
- 当指定路径上没有值, 或者不是 String 类型时, 返回这个值.boolean isString(java.lang.String path)
如果路径存在, 但不是 String, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a String.
If the path exists but is not a String, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a String and return appropriately.
path
- 检查指定路径是否是 String.int getInt(java.lang.String path)
如果这个 int 不存在, 但已指定一个缺省值, 这将返回缺省值.
如果这个 int 不存在, 并且没有指定缺省值, 则返回 0 .
原文: Gets the requested int by path.
If the int does not exist but a default value has been specified, this will return the default value. If the int does not exist and no default value was specified, this will return 0.
path
- 获取 int 的路径.int getInt(java.lang.String path, int def)
如果无法获取到一个 int, 将不会尝试去缺省列表中去获取, 而是直接返回指定的默认值.
原文: Gets the requested int by path, returning a default value if not found.
If the int does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
path
- 获取 int 的路径.def
- 当指定路径上没有值, 或者不是 int 类型时, 返回这个值.boolean isInt(java.lang.String path)
如果路径存在, 但不是 int, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a int.
If the path exists but is not a int, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a int and return appropriately.
path
- 检查指定路径是否是 int.boolean getBoolean(java.lang.String path)
如果这个 boolean 不存在, 但已指定一个缺省值, 这将返回缺省值.
如果这个 boolean 不存在, 并且没有指定缺省值, 则返回 false.
原文: Gets the requested boolean by path.
If the boolean does not exist but a default value has been specified, this will return the default value. If the boolean does not exist and no default value was specified, this will return false.
path
- 获取 boolean 的路径.boolean getBoolean(java.lang.String path, boolean def)
如果无法获取到一个 boolean, 将不会尝试去缺省列表中去获取, 而是直接返回指定的默认值.
原文: Gets the requested boolean by path, returning a default value if not found.
If the boolean does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
path
- 获取 boolean 的路径.def
- 当指定路径上没有值, 或者不是 boolean 类型时, 返回这个值.boolean isBoolean(java.lang.String path)
如果路径存在, 但不是 boolean, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a boolean.
If the path exists but is not a boolean, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a boolean and return appropriately.
path
- 检查指定路径是否是 boolean.double getDouble(java.lang.String path)
如果这个 double 不存在, 但已指定一个缺省值, 这将返回缺省值.
如果这个 double 不存在, 并且没有指定缺省值, 则返回0.
原文: Gets the requested double by path.
If the double does not exist but a default value has been specified, this will return the default value. If the double does not exist and no default value was specified, this will return 0.
path
- 获取double的路径.double getDouble(java.lang.String path, double def)
如果无法获取到一个 double, 将不会尝试去缺省列表中去获取, 而是直接返回指定的默认值.
原文: Gets the requested double by path, returning a default value if not found.
If the double does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
path
- 获取 double 的路径.def
- 当指定路径上没有值, 或者不是 double 类型时, 返回这个值.boolean isDouble(java.lang.String path)
如果路径存在, 但不是 double, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a double.
If the path exists but is not a double, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a double and return appropriately.
path
- 检查指定路径是否是 double.long getLong(java.lang.String path)
如果这个 long 不存在, 但已指定一个缺省值, 这将返回缺省值.
如果这个 long 不存在, 并且没有指定缺省值, 则返回 0.
原文: Gets the requested long by path.
If the long does not exist but a default value has been specified, this will return the default value. If the long does not exist and no default value was specified, this will return 0.
path
- 获取long的路径.long getLong(java.lang.String path, long def)
如果无法获取到一个 long, 将不会尝试去缺省列表中去获取, 而是直接返回指定的默认值.
原文: Gets the requested long by path, returning a default value if not found.
If the long does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
path
- 获取 long 的路径.def
- 当指定路径上没有值, 或者不是 long 类型时, 返回这个值.boolean isLong(java.lang.String path)
如果路径存在, 但不是 long, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a long.
If the path exists but is not a long, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a long and return appropriately.
path
- 检查指定路径是否是 long.java.util.List<?> getList(java.lang.String path)
如果这个 List 不存在, 但已指定一个缺省值, 这将返回缺省值.
如果这个 List 不存在, 并且没有指定缺省值, 则返回 null.
原文: Gets the requested List by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return null.
path
- 获取 List 的路径.java.util.List<?> getList(java.lang.String path, java.util.List<?> def)
如果无法获取到一个 List, 将不会尝试去缺省列表中去获取, 而是直接返回指定的默认值.
原文: Gets the requested List by path, returning a default value if not found.
If the List does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
path
- 获取 List 的路径.def
- 当指定路径上没有值, 或者不是 List 类型时, 返回这个值.boolean isList(java.lang.String path)
如果路径存在, 但不是 List, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a List.
If the path exists but is not a List, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a List and return appropriately.
path
- 检查指定路径是否是 List.java.util.List<java.lang.String> getStringList(java.lang.String path)
如果列表不存在,但已指定一个缺省值,这将返回默认值.
如果列表不存在,并且没有指定缺省值,这将返回一个空的列表.
此方法会尽可能的将 List 中所有的项转化为 String, 但是如果值本身不兼容, 将会发生不可预计的状况.
原文: Gets the requested List of String by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.
This method will attempt to cast any values into a String if possible, but may miss any values out if they are not compatible.
path
- 要获取 List<String> 的路径.java.util.List<java.lang.Integer> getIntegerList(java.lang.String path)
如果列表不存在,但已指定一个缺省值,这将返回默认值.
如果列表不存在,并且没有指定缺省值,这将返回一个空的列表.
此方法会尽可能的将 List 中所有的项转化为 Integer, 但是如果值本身不兼容, 将会发生不可预计的状况.
原文: Gets the requested List of Integer by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.
This method will attempt to cast any values into a Integer if possible, but may miss any values out if they are not compatible.
path
- 要获取 List<Integer> 的路径.java.util.List<java.lang.Boolean> getBooleanList(java.lang.String path)
如果列表不存在,但已指定一个缺省值,这将返回默认值.
如果列表不存在,并且没有指定缺省值,这将返回一个空的列表.
此方法会尽可能的将 List 中所有的项转化为 Boolean, 但是如果值本身不兼容, 将会发生不可预计的状况.
原文: Gets the requested List of Boolean by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.
This method will attempt to cast any values into a Boolean if possible, but may miss any values out if they are not compatible.
path
- 要获取 List<Boolean> 的路径.java.util.List<java.lang.Double> getDoubleList(java.lang.String path)
如果列表不存在,但已指定一个缺省值,这将返回默认值.
如果列表不存在,并且没有指定缺省值,这将返回一个空的列表.
此方法会尽可能的将 List 中所有的项转化为 Double, 但是如果值本身不兼容, 将会发生不可预计的状况.
原文: Gets the requested List of Double by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.
This method will attempt to cast any values into a Double if possible, but may miss any values out if they are not compatible.
path
- 要获取 List<Double>的路径.java.util.List<java.lang.Float> getFloatList(java.lang.String path)
如果列表不存在,但已指定一个缺省值,这将返回默认值.
如果列表不存在,并且没有指定缺省值,这将返回一个空的列表.
此方法会尽可能的将 List 中所有的项转化为 Float, 但是如果值本身不兼容, 将会发生不可预计的状况.
原文: Gets the requested List of Float by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.
This method will attempt to cast any values into a Float if possible, but may miss any values out if they are not compatible.
path
- 要获取 List<Float>的路径.java.util.List<java.lang.Long> getLongList(java.lang.String path)
如果列表不存在,但已指定一个缺省值,这将返回默认值.
如果列表不存在,并且没有指定缺省值,这将返回一个空的列表.
此方法会尽可能的将 List 中所有的项转化为Long, 但是如果值本身不兼容, 将会发生不可预计的状况.
原文: Gets the requested List of Long by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.
This method will attempt to cast any values into a Long if possible, but may miss any values out if they are not compatible.
path
- 要获取 List<Long>的路径.java.util.List<java.lang.Byte> getByteList(java.lang.String path)
如果列表不存在,但已指定一个缺省值,这将返回默认值.
如果列表不存在,并且没有指定缺省值,这将返回一个空的列表.
此方法会尽可能的将 List 中所有的项转化为 Byte, 但是如果值本身不兼容, 将会发生不可预计的状况.
原文: Gets the requested List of Byte by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.
This method will attempt to cast any values into a Byte if possible, but may miss any values out if they are not compatible.
path
- 要获取 List<Byte>的路径.java.util.List<java.lang.Character> getCharacterList(java.lang.String path)
如果列表不存在,但已指定一个缺省值,这将返回默认值.
如果列表不存在,并且没有指定缺省值,这将返回一个空的列表.
此方法会尽可能的将 List 中所有的项转化为 Character, 但是如果值本身不兼容, 将会发生不可预计的状况.
原文: Gets the requested List of Character by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.
This method will attempt to cast any values into a Character if possible, but may miss any values out if they are not compatible.
path
- 要获取 List<Character>的路径.java.util.List<java.lang.Short> getShortList(java.lang.String path)
如果列表不存在,但已指定一个缺省值,这将返回默认值.
如果列表不存在,并且没有指定缺省值,这将返回一个空的列表.
此方法会尽可能的将 List 中所有的项转化为 Short, 但是如果值本身不兼容, 将会发生不可预计的状况.
原文: Gets the requested List of Short by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.
This method will attempt to cast any values into a Short if possible, but may miss any values out if they are not compatible.
path
- 要获取 List<Short>的路径.java.util.List<java.util.Map<?,?>> getMapList(java.lang.String path)
如果列表不存在,但已指定一个缺省值,这将返回默认值.
如果列表不存在,并且没有指定缺省值,这将返回一个空的列表.
此方法会尽可能的将 List 中所有的项转化为 Map, 但是如果值本身不兼容, 将会发生不可预计的状况.
原文: Gets the requested List of Maps by path.
If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.
This method will attempt to cast any values into a Map if possible, but may miss any values out if they are not compatible.
path
- 要获取 List<Maps>的路径.<T extends ConfigurationSerializable> T getSerializable(java.lang.String path, java.lang.Class<T> clazz)
ConfigurationSerializable
object at the given
path.
If the Object does not exist but a default value has been specified, this
will return the default value. If the Object does not exist and no
default value was specified, this will return null.T
- the type of ConfigurationSerializable
path
- the path to the object.clazz
- the type of ConfigurationSerializable
ConfigurationSerializable
object<T extends ConfigurationSerializable> T getSerializable(java.lang.String path, java.lang.Class<T> clazz, T def)
ConfigurationSerializable
object at the given
path, returning a default value if not found
If the Object does not exist then the specified default value will
returned regardless of if a default has been identified in the root
Configuration
.T
- the type of ConfigurationSerializable
path
- the path to the object.clazz
- the type of ConfigurationSerializable
def
- the default object to return if the object is not present at
the pathConfigurationSerializable
objectVector getVector(java.lang.String path)
如果这个Vector不存在, 但已指定一个缺省值, 这将返回缺省值. Vector. 如果这个Vector不存在, 并且没有指定缺省值, 则返回null.
原文: Gets the requested Vector by path.
If the Vector does not exist but a default value has been specified, this will return the default value. If the Vector does not exist and no default value was specified, this will return null.
path
- 获取Vector的路径.Vector getVector(java.lang.String path, Vector def)
Vector
, 如果无法获取, 则直接返回默认值.
如果无法获取到一个 Vector
, 将不会尝试去缺省列表中去获取, 而是直接返回指定的默认值.
原文:
Gets the requested Vector
by path, returning a default value if not found.
If the Vector does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
boolean isVector(java.lang.String path)
Vector
.
如果路径存在, 但不是 Vector
, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a Vector.
If the path exists but is not a Vector, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a Vector and return appropriately.
OfflinePlayer getOfflinePlayer(java.lang.String path)
OfflinePlayer
类型的值.
如果这个 OfflinePlayer
不存在, 但已指定一个缺省值, 这将返回缺省值.
如果这个 OfflinePlayer
不存在, 并且没有指定缺省值, 则返回 null.
原文: Gets the requested OfflinePlayer by path.
If the OfflinePlayer does not exist but a default value has been specified, this will return the default value. If the OfflinePlayer does not exist and no default value was specified, this will return null.
path
- 获取 OfflinePlayer
的路径.OfflinePlayer
.OfflinePlayer getOfflinePlayer(java.lang.String path, OfflinePlayer def)
OfflinePlayer
, 如果无法获取, 则直接返回默认值.
如果无法获取到一个 OfflinePlayer
, 将不会尝试去缺省列表中去获取, 而是直接返回指定的默认值.
原文:
Gets the requested OfflinePlayer
by path, returning a default value if not found.
If the OfflinePlayer does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
path
- 获取 OfflinePlayer
的路径.def
- 当指定路径上没有值, 或者不是 OfflinePlayer
类型时, 返回这个值.OfflinePlayer
.boolean isOfflinePlayer(java.lang.String path)
OfflinePlayer
.
如果路径存在, 但不是 OfflinePlayer
, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a OfflinePlayer.
If the path exists but is not a OfflinePlayer, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a OfflinePlayer and return appropriately.
path
- 检查指定路径是否是 OfflinePlayer
.OfflinePlayer
.ItemStack getItemStack(java.lang.String path)
ItemStack
类型的值.
如果这个 ItemStack
不存在, 但已指定一个缺省值, 这将返回缺省值.
如果这个 ItemStack
不存在, 并且没有指定缺省值, 则返回 null.
原文: Gets the requested ItemStack by path.
If the ItemStack does not exist but a default value has been specified, this will return the default value. If the ItemStack does not exist and no default value was specified, this will return null.
ItemStack getItemStack(java.lang.String path, ItemStack def)
ItemStack
, 如果无法获取, 则直接返回默认值.
如果无法获取到一个 ItemStack
, 将不会尝试去缺省列表中去获取, 而是直接返回指定的默认值.
原文:
Gets the requested ItemStack
by path, returning a default value if not found.
If the ItemStack does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
path
- 获取ItemStack的路径.def
- 当指定路径上没有值, 或者不是ItemStack类型时, 返回这个值.boolean isItemStack(java.lang.String path)
ItemStack
.
如果路径存在, 但不是 ItemStack
, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a ItemStack.
If the path exists but is not a ItemStack, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a ItemStack and return appropriately.
Color getColor(java.lang.String path)
如果这个Color不存在, 但已指定一个缺省值, 这将返回缺省值. Color.
如果这个Color不存在, 并且没有指定缺省值, 则返回null.
原文: Gets the requested Color by path.
If the Color does not exist but a default value has been specified, this will return the default value. If the Color does not exist and no default value was specified, this will return null.
path
- 获取Color的路径.Color getColor(java.lang.String path, Color def)
Color
, 如果无法获取, 则直接返回指定默认值.
如果无法获取到一个 Color
, 将不会尝试去缺省列表中去获取, 而是直接返回指定的默认值.
原文:
Gets the requested Color
by path, returning a default value if not found.
If the Color does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration
.
boolean isColor(java.lang.String path)
Color
.
如果路径存在, 但不是 Color
, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a Color.
If the path exists but is not a Color, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a Color and return appropriately.
ConfigurationSection getConfigurationSection(java.lang.String path)
ConfigurationSection
,它是一个以指定路径作为基点的新的配置项,修改会同步.
如果这个 ConfigurationSection
不存在, 但已指定一个缺省值, 这将返回缺省值.
如果这个 ConfigurationSection
不存在, 并且没有指定缺省值, 则返回 null.
更人性化的解释: 现在有一个配置文件如下
root: branch1: branch1_1: something branch1_2: something branch2: branch2_1: something branch3_2: something如果调用
getConfigurationSection(java.lang.String)
参数为("branch1") ,则会返回
branch1: branch1_1: something branch1_2: something并且修改会同步
原文: Gets the requested ConfigurationSection by path.
If the ConfigurationSection does not exist but a default value has been specified, this will return the default value. If the ConfigurationSection does not exist and no default value was specified, this will return null.
path
- 获取 ConfigurationSection
的路径.ConfigurationSection
.boolean isConfigurationSection(java.lang.String path)
ConfigurationSection
.
如果路径存在, 但不是 ConfigurationSection
, 则返回 false.
如果路径不存在, 则返回 false.
如果路径不存在, 但在缺省列表中存在该路径, 则在缺省列表中重复匹配该规则, 直到返回一个适当的值.
原文: Checks if the specified path is a ConfigurationSection.
If the path exists but is not a ConfigurationSection, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a ConfigurationSection and return appropriately.
path
- 检查指定路径是否是 ConfigurationSection
.ConfigurationSection
.ConfigurationSection getDefaultSection()
ConfigurationSection
from the default Configuration
defined in getRoot()
.
If the root contains no defaults, or the defaults doesn't contain a value for this path, or the value at this path is not a ConfigurationSection
then this will return null.
void addDefault(java.lang.String path, java.lang.Object value)
如果缺省值 Configuration
没有被提供, 则自动创建一个新的.
如果值为 null, 表示从缺省值 Configuration
中删除这个路径上的默认值
如果 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 getDefaultSection()
is null, then this will create a new section at the path, replacing anything that may have existed there previously.
path
- 要设置缺省值的路径.value
- 要设置的值.java.lang.IllegalArgumentException
- 当路径为 null 时抛出此异常.