Class MemorySection
- All Implemented Interfaces:
ConfigurationSection
- Direct Known Subclasses:
MemoryConfiguration
public class MemorySection extends java.lang.Object implements ConfigurationSection
ConfigurationSection
that is stored in memory.-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Object>
map
-
Constructor Summary
Constructors Modifier Constructor Description protected
MemorySection()
Creates an empty MemorySection for use as a rootConfiguration
section.protected
MemorySection(ConfigurationSection parent, java.lang.String path)
Creates an empty MemorySection with the specified parent and path. -
Method Summary
Modifier and Type Method Description void
addDefault(java.lang.String path, java.lang.Object value)
Sets the default value in the root at the given path as provided.boolean
contains(java.lang.String path)
Checks if thisConfigurationSection
contains the given path.static java.lang.String
createPath(ConfigurationSection section, java.lang.String key)
Creates a full path to the givenConfigurationSection
from its rootConfiguration
.static java.lang.String
createPath(ConfigurationSection section, java.lang.String key, ConfigurationSection relativeTo)
Creates a relative path to the givenConfigurationSection
from the given relative section.ConfigurationSection
createSection(java.lang.String path)
Creates an emptyConfigurationSection
at the specified path.ConfigurationSection
createSection(java.lang.String path, java.util.Map<?,?> map)
Creates aConfigurationSection
at the specified path, with specified values.java.lang.Object
get(java.lang.String path)
Gets the requested Object by path.java.lang.Object
get(java.lang.String path, java.lang.Object def)
Gets the requested Object by path, returning a default value if not found.boolean
getBoolean(java.lang.String path)
Gets the requested boolean by path.boolean
getBoolean(java.lang.String path, boolean def)
Gets the requested boolean by path, returning a default value if not found.java.util.List<java.lang.Boolean>
getBooleanList(java.lang.String path)
Gets the requested List of Boolean by path.java.util.List<java.lang.Byte>
getByteList(java.lang.String path)
Gets the requested List of Byte by path.java.util.List<java.lang.Character>
getCharacterList(java.lang.String path)
Gets the requested List of Character by path.Color
getColor(java.lang.String path)
Gets the requested Color by path.Color
getColor(java.lang.String path, Color def)
Gets the requestedColor
by path, returning a default value if not found.ConfigurationSection
getConfigurationSection(java.lang.String path)
Gets the requested ConfigurationSection by path.java.lang.String
getCurrentPath()
Gets the path of thisConfigurationSection
from its rootConfiguration
protected java.lang.Object
getDefault(java.lang.String path)
ConfigurationSection
getDefaultSection()
Gets the equivalentConfigurationSection
from the defaultConfiguration
defined inConfigurationSection.getRoot()
.double
getDouble(java.lang.String path)
Gets the requested double by path.double
getDouble(java.lang.String path, double def)
Gets the requested double by path, returning a default value if not found.java.util.List<java.lang.Double>
getDoubleList(java.lang.String path)
Gets the requested List of Double by path.java.util.List<java.lang.Float>
getFloatList(java.lang.String path)
Gets the requested List of Float by path.int
getInt(java.lang.String path)
Gets the requested int by path.int
getInt(java.lang.String path, int def)
Gets the requested int by path, returning a default value if not found.java.util.List<java.lang.Integer>
getIntegerList(java.lang.String path)
Gets the requested List of Integer by path.ItemStack
getItemStack(java.lang.String path)
Gets the requested ItemStack by path.ItemStack
getItemStack(java.lang.String path, ItemStack def)
Gets the requestedItemStack
by path, returning a default value if not found.java.util.Set<java.lang.String>
getKeys(boolean deep)
Gets a set containing all keys in this section.java.util.List<?>
getList(java.lang.String path)
Gets the requested List by path.java.util.List<?>
getList(java.lang.String path, java.util.List<?> def)
Gets the requested List by path, returning a default value if not found.long
getLong(java.lang.String path)
Gets the requested long by path.long
getLong(java.lang.String path, long def)
Gets the requested long by path, returning a default value if not found.java.util.List<java.lang.Long>
getLongList(java.lang.String path)
Gets the requested List of Long by path.java.util.List<java.util.Map<?,?>>
getMapList(java.lang.String path)
Gets the requested List of Maps by path.java.lang.String
getName()
Gets the name of this individualConfigurationSection
, in the path.OfflinePlayer
getOfflinePlayer(java.lang.String path)
Gets the requested OfflinePlayer by path.OfflinePlayer
getOfflinePlayer(java.lang.String path, OfflinePlayer def)
Gets the requestedOfflinePlayer
by path, returning a default value if not found.ConfigurationSection
getParent()
Gets the parentConfigurationSection
that directly contains thisConfigurationSection
.Configuration
getRoot()
Gets the rootConfiguration
that contains thisConfigurationSection
java.util.List<java.lang.Short>
getShortList(java.lang.String path)
Gets the requested List of Short by path.java.lang.String
getString(java.lang.String path)
Gets the requested String by path.java.lang.String
getString(java.lang.String path, java.lang.String def)
Gets the requested String by path, returning a default value if not found.java.util.List<java.lang.String>
getStringList(java.lang.String path)
Gets the requested List of String by path.java.util.Map<java.lang.String,java.lang.Object>
getValues(boolean deep)
Gets a Map containing all keys and their values for this section.Vector
getVector(java.lang.String path)
Gets the requested Vector by path.Vector
getVector(java.lang.String path, Vector def)
Gets the requestedVector
by path, returning a default value if not found.boolean
isBoolean(java.lang.String path)
Checks if the specified path is a boolean.boolean
isColor(java.lang.String path)
Checks if the specified path is a Color.boolean
isConfigurationSection(java.lang.String path)
Checks if the specified path is a ConfigurationSection.boolean
isDouble(java.lang.String path)
Checks if the specified path is a double.boolean
isInt(java.lang.String path)
Checks if the specified path is an int.boolean
isItemStack(java.lang.String path)
Checks if the specified path is an ItemStack.boolean
isList(java.lang.String path)
Checks if the specified path is a List.boolean
isLong(java.lang.String path)
Checks if the specified path is a long.boolean
isOfflinePlayer(java.lang.String path)
Checks if the specified path is an OfflinePlayer.protected boolean
isPrimitiveWrapper(java.lang.Object input)
boolean
isSet(java.lang.String path)
Checks if thisConfigurationSection
has a value set for the given path.boolean
isString(java.lang.String path)
Checks if the specified path is a String.boolean
isVector(java.lang.String path)
Checks if the specified path is a Vector.protected void
mapChildrenKeys(java.util.Set<java.lang.String> output, ConfigurationSection section, boolean deep)
protected void
mapChildrenValues(java.util.Map<java.lang.String,java.lang.Object> output, ConfigurationSection section, boolean deep)
void
set(java.lang.String path, java.lang.Object value)
Sets the specified path to the given value.java.lang.String
toString()
-
Field Details
-
map
protected final java.util.Map<java.lang.String,java.lang.Object> map
-
-
Constructor Details
-
MemorySection
protected MemorySection()Creates an empty MemorySection for use as a rootConfiguration
section.Note that calling this without being yourself a
Configuration
will throw an exception!- Throws:
java.lang.IllegalStateException
- Thrown if this is not aConfiguration
root.
-
MemorySection
Creates an empty MemorySection with the specified parent and path.- Parameters:
parent
- Parent section that contains this own section.path
- Path that you may access this section from via the rootConfiguration
.- Throws:
java.lang.IllegalArgumentException
- Thrown is parent or path is null, or if parent contains no root Configuration.
-
-
Method Details
-
getKeys
public java.util.Set<java.lang.String> getKeys(boolean deep)Description copied from interface:ConfigurationSection
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.
- Specified by:
getKeys
in interfaceConfigurationSection
- Parameters:
deep
- Whether or not to get a deep list, as opposed to a shallow list.- Returns:
- Set of keys contained within this ConfigurationSection.
-
getValues
public java.util.Map<java.lang.String,java.lang.Object> getValues(boolean deep)Description copied from interface:ConfigurationSection
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.
- Specified by:
getValues
in interfaceConfigurationSection
- Parameters:
deep
- Whether or not to get a deep list, as opposed to a shallow list.- Returns:
- Map of keys and values of this section.
-
contains
public boolean contains(java.lang.String path)Description copied from interface:ConfigurationSection
Checks if thisConfigurationSection
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.
- Specified by:
contains
in interfaceConfigurationSection
- Parameters:
path
- Path to check for existence.- Returns:
- True if this section contains the requested path, either via default or being set.
-
isSet
public boolean isSet(java.lang.String path)Description copied from interface:ConfigurationSection
Checks if thisConfigurationSection
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.
- Specified by:
isSet
in interfaceConfigurationSection
- Parameters:
path
- Path to check for existence.- Returns:
- True if this section contains the requested path, regardless of having a default.
-
getCurrentPath
public java.lang.String getCurrentPath()Description copied from interface:ConfigurationSection
Gets the path of thisConfigurationSection
from its rootConfiguration
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
ConfigurationSection.getName()
.- Specified by:
getCurrentPath
in interfaceConfigurationSection
- Returns:
- Path of this section relative to its root
-
getName
public java.lang.String getName()Description copied from interface:ConfigurationSection
Gets the name of this individualConfigurationSection
, in the path.This will always be the final part of
ConfigurationSection.getCurrentPath()
, unless the section is orphaned.- Specified by:
getName
in interfaceConfigurationSection
- Returns:
- Name of this section
-
getRoot
Description copied from interface:ConfigurationSection
Gets the rootConfiguration
that contains thisConfigurationSection
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.
- Specified by:
getRoot
in interfaceConfigurationSection
- Returns:
- Root configuration containing this section.
-
getParent
Description copied from interface:ConfigurationSection
Gets the parentConfigurationSection
that directly contains thisConfigurationSection
.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.
- Specified by:
getParent
in interfaceConfigurationSection
- Returns:
- Parent section containing this section.
-
addDefault
public void addDefault(java.lang.String path, java.lang.Object value)Description copied from interface:ConfigurationSection
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 newMemoryConfiguration
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.- Specified by:
addDefault
in interfaceConfigurationSection
- Parameters:
path
- Path of the value to set.value
- Value to set the default to.
-
getDefaultSection
Description copied from interface:ConfigurationSection
Gets the equivalentConfigurationSection
from the defaultConfiguration
defined inConfigurationSection.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.- Specified by:
getDefaultSection
in interfaceConfigurationSection
- Returns:
- Equivalent section in root configuration
-
set
public void set(java.lang.String path, java.lang.Object value)Description copied from interface:ConfigurationSection
Sets the specified path to the given 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 orConfigurationSection
s, please useConfigurationSection.createSection(java.lang.String)
for that.- Specified by:
set
in interfaceConfigurationSection
- Parameters:
path
- Path of the object to set.value
- New value to set the path to.
-
get
public java.lang.Object get(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
get
in interfaceConfigurationSection
- Parameters:
path
- Path of the Object to get.- Returns:
- Requested Object.
-
get
public java.lang.Object get(java.lang.String path, java.lang.Object def)Description copied from interface:ConfigurationSection
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
.- Specified by:
get
in interfaceConfigurationSection
- Parameters:
path
- Path of the Object to get.def
- The default value to return if the path is not found.- Returns:
- Requested Object.
-
createSection
Description copied from interface:ConfigurationSection
Creates an emptyConfigurationSection
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.- Specified by:
createSection
in interfaceConfigurationSection
- Parameters:
path
- Path to create the section at.- Returns:
- Newly created section
-
createSection
Description copied from interface:ConfigurationSection
Creates aConfigurationSection
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.- Specified by:
createSection
in interfaceConfigurationSection
- Parameters:
path
- Path to create the section at.map
- The values to used.- Returns:
- Newly created section
-
getString
public java.lang.String getString(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getString
in interfaceConfigurationSection
- Parameters:
path
- Path of the String to get.- Returns:
- Requested String.
-
getString
public java.lang.String getString(java.lang.String path, java.lang.String def)Description copied from interface:ConfigurationSection
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
.- Specified by:
getString
in interfaceConfigurationSection
- Parameters:
path
- Path of the String to get.def
- The default value to return if the path is not found or is not a String.- Returns:
- Requested String.
-
isString
public boolean isString(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
isString
in interfaceConfigurationSection
- Parameters:
path
- Path of the String to check.- Returns:
- Whether or not the specified path is a String.
-
getInt
public int getInt(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getInt
in interfaceConfigurationSection
- Parameters:
path
- Path of the int to get.- Returns:
- Requested int.
-
getInt
public int getInt(java.lang.String path, int def)Description copied from interface:ConfigurationSection
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
.- Specified by:
getInt
in interfaceConfigurationSection
- Parameters:
path
- Path of the int to get.def
- The default value to return if the path is not found or is not an int.- Returns:
- Requested int.
-
isInt
public boolean isInt(java.lang.String path)Description copied from interface:ConfigurationSection
Checks if the specified path is an 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.
- Specified by:
isInt
in interfaceConfigurationSection
- Parameters:
path
- Path of the int to check.- Returns:
- Whether or not the specified path is an int.
-
getBoolean
public boolean getBoolean(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getBoolean
in interfaceConfigurationSection
- Parameters:
path
- Path of the boolean to get.- Returns:
- Requested boolean.
-
getBoolean
public boolean getBoolean(java.lang.String path, boolean def)Description copied from interface:ConfigurationSection
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
.- Specified by:
getBoolean
in interfaceConfigurationSection
- Parameters:
path
- Path of the boolean to get.def
- The default value to return if the path is not found or is not a boolean.- Returns:
- Requested boolean.
-
isBoolean
public boolean isBoolean(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
isBoolean
in interfaceConfigurationSection
- Parameters:
path
- Path of the boolean to check.- Returns:
- Whether or not the specified path is a boolean.
-
getDouble
public double getDouble(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getDouble
in interfaceConfigurationSection
- Parameters:
path
- Path of the double to get.- Returns:
- Requested double.
-
getDouble
public double getDouble(java.lang.String path, double def)Description copied from interface:ConfigurationSection
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
.- Specified by:
getDouble
in interfaceConfigurationSection
- Parameters:
path
- Path of the double to get.def
- The default value to return if the path is not found or is not a double.- Returns:
- Requested double.
-
isDouble
public boolean isDouble(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
isDouble
in interfaceConfigurationSection
- Parameters:
path
- Path of the double to check.- Returns:
- Whether or not the specified path is a double.
-
getLong
public long getLong(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getLong
in interfaceConfigurationSection
- Parameters:
path
- Path of the long to get.- Returns:
- Requested long.
-
getLong
public long getLong(java.lang.String path, long def)Description copied from interface:ConfigurationSection
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
.- Specified by:
getLong
in interfaceConfigurationSection
- Parameters:
path
- Path of the long to get.def
- The default value to return if the path is not found or is not a long.- Returns:
- Requested long.
-
isLong
public boolean isLong(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
isLong
in interfaceConfigurationSection
- Parameters:
path
- Path of the long to check.- Returns:
- Whether or not the specified path is a long.
-
getList
public java.util.List<?> getList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List.
-
getList
public java.util.List<?> getList(java.lang.String path, java.util.List<?> def)Description copied from interface:ConfigurationSection
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
.- Specified by:
getList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.def
- The default value to return if the path is not found or is not a List.- Returns:
- Requested List.
-
isList
public boolean isList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
isList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to check.- Returns:
- Whether or not the specified path is a List.
-
getStringList
public java.util.List<java.lang.String> getStringList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getStringList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List of String.
-
getIntegerList
public java.util.List<java.lang.Integer> getIntegerList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getIntegerList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List of Integer.
-
getBooleanList
public java.util.List<java.lang.Boolean> getBooleanList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getBooleanList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List of Boolean.
-
getDoubleList
public java.util.List<java.lang.Double> getDoubleList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getDoubleList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List of Double.
-
getFloatList
public java.util.List<java.lang.Float> getFloatList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getFloatList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List of Float.
-
getLongList
public java.util.List<java.lang.Long> getLongList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getLongList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List of Long.
-
getByteList
public java.util.List<java.lang.Byte> getByteList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getByteList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List of Byte.
-
getCharacterList
public java.util.List<java.lang.Character> getCharacterList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getCharacterList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List of Character.
-
getShortList
public java.util.List<java.lang.Short> getShortList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getShortList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List of Short.
-
getMapList
public java.util.List<java.util.Map<?,?>> getMapList(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
getMapList
in interfaceConfigurationSection
- Parameters:
path
- Path of the List to get.- Returns:
- Requested List of Maps.
-
getVector
Description copied from interface:ConfigurationSection
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.
- Specified by:
getVector
in interfaceConfigurationSection
- Parameters:
path
- Path of the Vector to get.- Returns:
- Requested Vector.
-
getVector
Description copied from interface:ConfigurationSection
Gets the requestedVector
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
.- Specified by:
getVector
in interfaceConfigurationSection
- Parameters:
path
- Path of the Vector to get.def
- The default value to return if the path is not found or is not a Vector.- Returns:
- Requested Vector.
-
isVector
public boolean isVector(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
isVector
in interfaceConfigurationSection
- Parameters:
path
- Path of the Vector to check.- Returns:
- Whether or not the specified path is a Vector.
-
getOfflinePlayer
Description copied from interface:ConfigurationSection
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.
- Specified by:
getOfflinePlayer
in interfaceConfigurationSection
- Parameters:
path
- Path of the OfflinePlayer to get.- Returns:
- Requested OfflinePlayer.
-
getOfflinePlayer
Description copied from interface:ConfigurationSection
Gets the requestedOfflinePlayer
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
.- Specified by:
getOfflinePlayer
in interfaceConfigurationSection
- Parameters:
path
- Path of the OfflinePlayer to get.def
- The default value to return if the path is not found or is not an OfflinePlayer.- Returns:
- Requested OfflinePlayer.
-
isOfflinePlayer
public boolean isOfflinePlayer(java.lang.String path)Description copied from interface:ConfigurationSection
Checks if the specified path is an 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.
- Specified by:
isOfflinePlayer
in interfaceConfigurationSection
- Parameters:
path
- Path of the OfflinePlayer to check.- Returns:
- Whether or not the specified path is an OfflinePlayer.
-
getItemStack
Description copied from interface:ConfigurationSection
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.
- Specified by:
getItemStack
in interfaceConfigurationSection
- Parameters:
path
- Path of the ItemStack to get.- Returns:
- Requested ItemStack.
-
getItemStack
Description copied from interface:ConfigurationSection
Gets the requestedItemStack
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
.- Specified by:
getItemStack
in interfaceConfigurationSection
- Parameters:
path
- Path of the ItemStack to get.def
- The default value to return if the path is not found or is not an ItemStack.- Returns:
- Requested ItemStack.
-
isItemStack
public boolean isItemStack(java.lang.String path)Description copied from interface:ConfigurationSection
Checks if the specified path is an 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.
- Specified by:
isItemStack
in interfaceConfigurationSection
- Parameters:
path
- Path of the ItemStack to check.- Returns:
- Whether or not the specified path is an ItemStack.
-
getColor
Description copied from interface:ConfigurationSection
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.
- Specified by:
getColor
in interfaceConfigurationSection
- Parameters:
path
- Path of the Color to get.- Returns:
- Requested Color.
-
getColor
Description copied from interface:ConfigurationSection
Gets the requestedColor
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
.- Specified by:
getColor
in interfaceConfigurationSection
- Parameters:
path
- Path of the Color to get.def
- The default value to return if the path is not found or is not a Color.- Returns:
- Requested Color.
-
isColor
public boolean isColor(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
isColor
in interfaceConfigurationSection
- Parameters:
path
- Path of the Color to check.- Returns:
- Whether or not the specified path is a Color.
-
getConfigurationSection
Description copied from interface:ConfigurationSection
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.
- Specified by:
getConfigurationSection
in interfaceConfigurationSection
- Parameters:
path
- Path of the ConfigurationSection to get.- Returns:
- Requested ConfigurationSection.
-
isConfigurationSection
public boolean isConfigurationSection(java.lang.String path)Description copied from interface:ConfigurationSection
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.
- Specified by:
isConfigurationSection
in interfaceConfigurationSection
- Parameters:
path
- Path of the ConfigurationSection to check.- Returns:
- Whether or not the specified path is a ConfigurationSection.
-
isPrimitiveWrapper
protected boolean isPrimitiveWrapper(java.lang.Object input) -
getDefault
protected java.lang.Object getDefault(java.lang.String path) -
mapChildrenKeys
protected void mapChildrenKeys(java.util.Set<java.lang.String> output, ConfigurationSection section, boolean deep) -
mapChildrenValues
protected void mapChildrenValues(java.util.Map<java.lang.String,java.lang.Object> output, ConfigurationSection section, boolean deep) -
createPath
Creates a full path to the givenConfigurationSection
from its rootConfiguration
.You may use this method for any given
ConfigurationSection
, not onlyMemorySection
.- Parameters:
section
- Section to create a path for.key
- Name of the specified section.- Returns:
- Full path of the section from its root.
-
createPath
public static java.lang.String createPath(ConfigurationSection section, java.lang.String key, ConfigurationSection relativeTo)Creates a relative path to the givenConfigurationSection
from the given relative section.You may use this method for any given
ConfigurationSection
, not onlyMemorySection
.- Parameters:
section
- Section to create a path for.key
- Name of the specified section.relativeTo
- Section to create the path relative to.- Returns:
- Full path of the section from its root.
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-