public interface ConfigurationSection
Configuration
Modifier and Type | Method and Description |
---|---|
void |
addDefault(@NotNull String path,
@Nullable Object value)
Sets the default value in the root at the given path as provided.
|
boolean |
contains(@NotNull String path)
Checks if this
ConfigurationSection contains the given path. |
boolean |
contains(@NotNull String path,
boolean ignoreDefault)
Checks if this
ConfigurationSection contains the given path. |
@NotNull ConfigurationSection |
createSection(@NotNull String path)
Creates an empty
ConfigurationSection at the specified path. |
@NotNull ConfigurationSection |
createSection(@NotNull String path,
@NotNull Map<?,?> map)
Creates a
ConfigurationSection at the specified path, with
specified values. |
@Nullable Object |
get(@NotNull String path)
Gets the requested Object by path.
|
@Nullable Object |
get(@NotNull String path,
@Nullable Object def)
Gets the requested Object by path, returning a default value if not
found.
|
boolean |
getBoolean(@NotNull String path)
Gets the requested boolean by path.
|
boolean |
getBoolean(@NotNull String path,
boolean def)
Gets the requested boolean by path, returning a default value if not
found.
|
@NotNull List<Boolean> |
getBooleanList(@NotNull String path)
Gets the requested List of Boolean by path.
|
@NotNull List<Byte> |
getByteList(@NotNull String path)
Gets the requested List of Byte by path.
|
@NotNull List<Character> |
getCharacterList(@NotNull String path)
Gets the requested List of Character by path.
|
@Nullable Color |
getColor(@NotNull String path)
Gets the requested Color by path.
|
@Nullable Color |
getColor(@NotNull String path,
@Nullable Color def)
Gets the requested
Color by path, returning a default value if
not found. |
@Nullable ConfigurationSection |
getConfigurationSection(@NotNull String path)
Gets the requested ConfigurationSection by path.
|
@Nullable String |
getCurrentPath()
Gets the path of this
ConfigurationSection from its root Configuration |
@Nullable ConfigurationSection |
getDefaultSection()
|
double |
getDouble(@NotNull String path)
Gets the requested double by path.
|
double |
getDouble(@NotNull String path,
double def)
Gets the requested double by path, returning a default value if not
found.
|
@NotNull List<Double> |
getDoubleList(@NotNull String path)
Gets the requested List of Double by path.
|
@NotNull List<Float> |
getFloatList(@NotNull String path)
Gets the requested List of Float by path.
|
int |
getInt(@NotNull String path)
Gets the requested int by path.
|
int |
getInt(@NotNull String path,
int def)
Gets the requested int by path, returning a default value if not found.
|
@NotNull List<Integer> |
getIntegerList(@NotNull String path)
Gets the requested List of Integer by path.
|
@Nullable ItemStack |
getItemStack(@NotNull String path)
Gets the requested ItemStack by path.
|
@Nullable ItemStack |
getItemStack(@NotNull String path,
@Nullable ItemStack def)
Gets the requested
ItemStack by path, returning a default value
if not found. |
@NotNull Set<String> |
getKeys(boolean deep)
Gets a set containing all keys in this section.
|
@Nullable List<?> |
getList(@NotNull String path)
Gets the requested List by path.
|
@Nullable List<?> |
getList(@NotNull String path,
@Nullable List<?> def)
Gets the requested List by path, returning a default value if not
found.
|
@Nullable Location |
getLocation(@NotNull String path)
Gets the requested Location by path.
|
@Nullable Location |
getLocation(@NotNull String path,
@Nullable Location def)
Gets the requested
Location by path, returning a default value if
not found. |
long |
getLong(@NotNull String path)
Gets the requested long by path.
|
long |
getLong(@NotNull String path,
long def)
Gets the requested long by path, returning a default value if not
found.
|
@NotNull List<Long> |
getLongList(@NotNull String path)
Gets the requested List of Long by path.
|
@NotNull List<Map<?,?>> |
getMapList(@NotNull String path)
Gets the requested List of Maps by path.
|
@NotNull String |
getName()
Gets the name of this individual
ConfigurationSection , in the
path. |
<T> T |
getObject(@NotNull String path,
@NotNull Class<T> clazz)
Gets the requested object at the given path.
|
<T> T |
getObject(@NotNull String path,
@NotNull Class<T> clazz,
T def)
Gets the requested 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 . |
@Nullable OfflinePlayer |
getOfflinePlayer(@NotNull String path)
Gets the requested OfflinePlayer by path.
|
@Nullable OfflinePlayer |
getOfflinePlayer(@NotNull String path,
@Nullable OfflinePlayer def)
Gets the requested
OfflinePlayer by path, returning a default
value if not found. |
@Nullable ConfigurationSection |
getParent()
Gets the parent
ConfigurationSection that directly contains
this ConfigurationSection . |
@Nullable Configuration |
getRoot()
Gets the root
Configuration that contains this ConfigurationSection |
<T extends ConfigurationSerializable> |
getSerializable(@NotNull String path,
@NotNull Class<T> clazz)
Gets the requested
ConfigurationSerializable object at the given
path. |
<T extends ConfigurationSerializable> |
getSerializable(@NotNull String path,
@NotNull 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 . |
@NotNull List<Short> |
getShortList(@NotNull String path)
Gets the requested List of Short by path.
|
@Nullable String |
getString(@NotNull String path)
Gets the requested String by path.
|
@Nullable String |
getString(@NotNull String path,
@Nullable String def)
Gets the requested String by path, returning a default value if not
found.
|
@NotNull List<String> |
getStringList(@NotNull String path)
Gets the requested List of String by path.
|
@NotNull Map<String,Object> |
getValues(boolean deep)
Gets a Map containing all keys and their values for this section.
|
@Nullable Vector |
getVector(@NotNull String path)
Gets the requested Vector by path.
|
@Nullable Vector |
getVector(@NotNull String path,
@Nullable Vector def)
Gets the requested
Vector by path, returning a default value if
not found. |
boolean |
isBoolean(@NotNull String path)
Checks if the specified path is a boolean.
|
boolean |
isColor(@NotNull String path)
Checks if the specified path is a Color.
|
boolean |
isConfigurationSection(@NotNull String path)
Checks if the specified path is a ConfigurationSection.
|
boolean |
isDouble(@NotNull String path)
Checks if the specified path is a double.
|
boolean |
isInt(@NotNull String path)
Checks if the specified path is an int.
|
boolean |
isItemStack(@NotNull String path)
Checks if the specified path is an ItemStack.
|
boolean |
isList(@NotNull String path)
Checks if the specified path is a List.
|
boolean |
isLocation(@NotNull String path)
Checks if the specified path is a Location.
|
boolean |
isLong(@NotNull String path)
Checks if the specified path is a long.
|
boolean |
isOfflinePlayer(@NotNull String path)
Checks if the specified path is an OfflinePlayer.
|
boolean |
isSet(@NotNull String path)
Checks if this
ConfigurationSection has a value set for the
given path. |
boolean |
isString(@NotNull String path)
Checks if the specified path is a String.
|
boolean |
isVector(@NotNull String path)
Checks if the specified path is a Vector.
|
void |
set(@NotNull String path,
@Nullable Object value)
Sets the specified path to the given value.
|
@NotNull @NotNull Set<String> getKeys(boolean deep)
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
- Whether or not to get a deep list, as opposed to a shallow
list.@NotNull @NotNull Map<String,Object> getValues(boolean deep)
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
- Whether or not to get a deep list, as opposed to a shallow
list.boolean contains(@NotNull @NotNull String path)
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
- Path to check for existence.IllegalArgumentException
- Thrown when path is null.boolean contains(@NotNull @NotNull 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.IllegalArgumentException
- Thrown when path is null.boolean isSet(@NotNull @NotNull String path)
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
- Path to check for existence.IllegalArgumentException
- Thrown when path is null.@Nullable @Nullable String getCurrentPath()
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()
.
@NotNull @NotNull String getName()
ConfigurationSection
, in the
path.
This will always be the final part of getCurrentPath()
, unless
the section is orphaned.
@Nullable @Nullable 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.
@Nullable @Nullable 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.
@Nullable @Nullable Object get(@NotNull @NotNull String 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
- Path of the Object to get.@Contract(value="_, !null -> !null") @Nullable @Nullable Object get(@NotNull @NotNull String path, @Nullable @Nullable Object def)
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
- Path of the Object to get.def
- The default value to return if the path is not found.void set(@NotNull @NotNull String path, @Nullable @Nullable 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.@NotNull @NotNull ConfigurationSection createSection(@NotNull @NotNull 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.@NotNull @NotNull ConfigurationSection createSection(@NotNull @NotNull String path, @NotNull @NotNull 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.@Nullable @Nullable String getString(@NotNull @NotNull String 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
- Path of the String to get.@Contract(value="_, !null -> !null") @Nullable @Nullable String getString(@NotNull @NotNull String path, @Nullable @Nullable String def)
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
- Path of the String to get.def
- The default value to return if the path is not found or is
not a String.boolean isString(@NotNull @NotNull String path)
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
- Path of the String to check.int getInt(@NotNull @NotNull String 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
- Path of the int to get.int getInt(@NotNull @NotNull String path, int def)
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
- Path of the int to get.def
- The default value to return if the path is not found or is
not an int.boolean isInt(@NotNull @NotNull String path)
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
- Path of the int to check.boolean getBoolean(@NotNull @NotNull String 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
- Path of the boolean to get.boolean getBoolean(@NotNull @NotNull String path, boolean def)
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
- Path of the boolean to get.def
- The default value to return if the path is not found or is
not a boolean.boolean isBoolean(@NotNull @NotNull String path)
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
- Path of the boolean to check.double getDouble(@NotNull @NotNull String 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
- Path of the double to get.double getDouble(@NotNull @NotNull String path, double def)
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
- Path of the double to get.def
- The default value to return if the path is not found or is
not a double.boolean isDouble(@NotNull @NotNull String path)
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
- Path of the double to check.long getLong(@NotNull @NotNull String 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
- Path of the long to get.long getLong(@NotNull @NotNull String path, long def)
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
- Path of the long to get.def
- The default value to return if the path is not found or is
not a long.boolean isLong(@NotNull @NotNull String path)
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
- Path of the long to check.@Nullable @Nullable List<?> getList(@NotNull @NotNull String 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
- Path of the List to get.@Contract(value="_, !null -> !null") @Nullable @Nullable List<?> getList(@NotNull @NotNull String path, @Nullable @Nullable List<?> def)
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
- Path of the List to get.def
- The default value to return if the path is not found or is
not a List.boolean isList(@NotNull @NotNull String path)
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
- Path of the List to check.@NotNull @NotNull List<String> getStringList(@NotNull @NotNull String 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
- Path of the List to get.@NotNull @NotNull List<Integer> getIntegerList(@NotNull @NotNull String 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
- Path of the List to get.@NotNull @NotNull List<Boolean> getBooleanList(@NotNull @NotNull String 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
- Path of the List to get.@NotNull @NotNull List<Double> getDoubleList(@NotNull @NotNull String 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
- Path of the List to get.@NotNull @NotNull List<Float> getFloatList(@NotNull @NotNull String 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
- Path of the List to get.@NotNull @NotNull List<Long> getLongList(@NotNull @NotNull String 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
- Path of the List to get.@NotNull @NotNull List<Byte> getByteList(@NotNull @NotNull String 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
- Path of the List to get.@NotNull @NotNull List<Character> getCharacterList(@NotNull @NotNull String 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
- Path of the List to get.@NotNull @NotNull List<Short> getShortList(@NotNull @NotNull String 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
- Path of the List to get.@NotNull @NotNull List<Map<?,?>> getMapList(@NotNull @NotNull String 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
- Path of the List to get.@Nullable <T> T getObject(@NotNull @NotNull String path, @NotNull @NotNull Class<T> clazz)
#getString(path)
because
#getString(path)
converts internally all
Objects to Strings. However, #getObject(path, Boolean.class) is
equivalent to #getBoolean(path)
for example.T
- the type of the requested objectpath
- the path to the object.clazz
- the type of the requested object@Contract(value="_, _, !null -> !null") @Nullable <T> T getObject(@NotNull @NotNull String path, @NotNull @NotNull Class<T> clazz, @Nullable T def)
Configuration
.
Note: For example #getObject(path, String.class, def) is
not equivalent to
#getString(path, def)
because
#getString(path, def)
converts
internally all Objects to Strings. However, #getObject(path,
Boolean.class, def) is equivalent to #getBoolean(path,
def)
for example.T
- the type of the requested objectpath
- the path to the object.clazz
- the type of the requested objectdef
- the default object to return if the object is not present at
the path@Nullable <T extends ConfigurationSerializable> T getSerializable(@NotNull @NotNull String path, @NotNull @NotNull 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@Contract(value="_, _, !null -> !null") @Nullable <T extends ConfigurationSerializable> T getSerializable(@NotNull @NotNull String path, @NotNull @NotNull Class<T> clazz, @Nullable 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
object@Nullable @Nullable Vector getVector(@NotNull @NotNull String 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
- Path of the Vector to get.@Contract(value="_, !null -> !null") @Nullable @Nullable Vector getVector(@NotNull @NotNull String path, @Nullable @Nullable Vector def)
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
.
path
- Path of the Vector to get.def
- The default value to return if the path is not found or is
not a Vector.boolean isVector(@NotNull @NotNull String path)
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.
path
- Path of the Vector to check.@Nullable @Nullable OfflinePlayer getOfflinePlayer(@NotNull @NotNull String 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
- Path of the OfflinePlayer to get.@Contract(value="_, !null -> !null") @Nullable @Nullable OfflinePlayer getOfflinePlayer(@NotNull @NotNull String path, @Nullable @Nullable OfflinePlayer def)
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
- Path of the OfflinePlayer to get.def
- The default value to return if the path is not found or is
not an OfflinePlayer.boolean isOfflinePlayer(@NotNull @NotNull String path)
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
- Path of the OfflinePlayer to check.@Nullable @Nullable ItemStack getItemStack(@NotNull @NotNull String 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.
path
- Path of the ItemStack to get.@Contract(value="_, !null -> !null") @Nullable @Nullable ItemStack getItemStack(@NotNull @NotNull String path, @Nullable @Nullable ItemStack def)
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
- Path of the ItemStack to get.def
- The default value to return if the path is not found or is
not an ItemStack.boolean isItemStack(@NotNull @NotNull String path)
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.
path
- Path of the ItemStack to check.@Nullable @Nullable Color getColor(@NotNull @NotNull String 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
- Path of the Color to get.@Contract(value="_, !null -> !null") @Nullable @Nullable Color getColor(@NotNull @NotNull String path, @Nullable @Nullable Color def)
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
.
path
- Path of the Color to get.def
- The default value to return if the path is not found or is
not a Color.boolean isColor(@NotNull @NotNull String path)
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.
path
- Path of the Color to check.@Nullable @Nullable Location getLocation(@NotNull @NotNull String path)
If the Location does not exist but a default value has been specified, this will return the default value. If the Location does not exist and no default value was specified, this will return null.
path
- Path of the Location to get.@Contract(value="_, !null -> !null") @Nullable @Nullable Location getLocation(@NotNull @NotNull String path, @Nullable @Nullable Location def)
Location
by path, returning a default value if
not found.
If the Location does not exist then the specified default value will
returned regardless of if a default has been identified in the root
Configuration
.
path
- Path of the Location to get.def
- The default value to return if the path is not found or is not
a Location.boolean isLocation(@NotNull @NotNull String path)
If the path exists but is not a Location, 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 Location and return appropriately.
path
- Path of the Location to check.@Nullable @Nullable ConfigurationSection getConfigurationSection(@NotNull @NotNull String 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
- Path of the ConfigurationSection to get.boolean isConfigurationSection(@NotNull @NotNull String path)
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
- Path of the ConfigurationSection to check.@Nullable @Nullable 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(@NotNull @NotNull String path, @Nullable @Nullable Object value)
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
- Path of the value to set.value
- Value to set the default to.IllegalArgumentException
- Thrown if path is null.Copyright © 2021. All rights reserved.