Class YAMLNode
java.lang.Object
com.sk89q.util.yaml.YAMLNode
- Direct Known Subclasses:
YAMLProcessor
Represents a configuration node.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a new node to the given path.voidclear()Clear all nodes.getBlockVector2List(String path, List<BlockVector2> def) Gets a list of 2D vectors.getBoolean(String path) Gets a Boolean at a location.booleangetBoolean(String path, boolean def) Gets a Boolean at a location.getBooleanList(String path, List<Boolean> def) Gets a list of Booleans.Gets a double at a location.doubleGets a double at a location.getDoubleList(String path, List<Double> def) Gets a list of Doubles.Gets an integer at a location.intGets an integer at a location.getIntList(String path, List<Integer> def) Gets a list of integers.Get a list of keys at a location.Gets a list of objects at a location.getMap()Return the underlying map.Get a configuration node at a path.getNodeList(String path, List<YAMLNode> def) Gets a list of nodes.Get a list of nodes at a location.getProperty(String path) Gets a property at a location.Gets a string at a location.Gets a string at a location.getStringList(String path, List<String> def) Gets a list of Strings.Gets a vector at a location.Gets a string at a location.getVector2(String path) Gets a 2D vector at a location.getVector2List(String path, List<Vector2> def) Gets a list of 2D vectors.getVectorList(String path, List<Vector3> def) Gets a list of vectors.voidremoveProperty(String path) Remove the property at a location.voidsetProperty(String path, Object value) Set the property at a location.voidsetWriteDefaults(boolean writeDefaults) boolean
-
Field Details
-
root
-
-
Constructor Details
-
YAMLNode
-
-
Method Details
-
getMap
-
clear
public void clear()Clear all nodes. -
getProperty
Gets a property at a location. This will either return an Object or null, with null meaning that no configuration value exists at that location. This could potentially return a default value (not yet implemented) as defined by a plugin, if this is a plugin-tied configuration.- Parameters:
path- path to node (dot notation)- Returns:
- object or null
-
setProperty
-
addNode
-
getString
Gets a string at a location. This will either return a String or null, with null meaning that no configuration value exists at that location. If the object at the particular location is not actually a string, it will be converted to its string representation.- Parameters:
path- path to node (dot notation)- Returns:
- string or null
-
getVector
Gets a vector at a location. This will either return a Vector or a null. If the object at the particular location is not actually a string, it will be converted to its string representation.- Parameters:
path- path to node (dot notation)- Returns:
- string or default
-
getVector2
Gets a 2D vector at a location. This will either return a Vector or a null. If the object at the particular location is not actually a string, it will be converted to its string representation.- Parameters:
path- path to node (dot notation)- Returns:
- string or default
-
getVector
Gets a string at a location. This will either return a Vector, or the default value. If the object at the particular location is not actually a string, it will be converted to its string representation.- Parameters:
path- path to node (dot notation)def- default value- Returns:
- string or default
-
getString
Gets a string at a location. This will either return a String, or the default value. If the object at the particular location is not actually a string, it will be converted to its string representation.- Parameters:
path- path to node (dot notation)def- default value- Returns:
- string or default
-
getInt
Gets an integer at a location. This will either return an Integer, or null. If the object at the particular location is not actually an Integer, the default value will be returned. However, other number types will be casted to an Integer.- Parameters:
path- path to node (dot notation)- Returns:
- Integer or null
-
getInt
Gets an integer at a location. This will either return an Integer, or the default value. If the object at the particular location is not actually an Integer, the default value will be returned. However, other number types will be casted to an integer.- Parameters:
path- path to node (dot notation)def- default value- Returns:
- Integer or default
-
getDouble
Gets a double at a location. This will either return a Double, or null. If the object at the particular location is not actually a Double, the default value will be returned. However, other number types will be casted to a Double.- Parameters:
path- path to node (dot notation)- Returns:
- Double or null
-
getDouble
Gets a double at a location. This will either return a Double, or the default value. If the object at the particular location is not actually a Double, the default value will be returned. However, other number types will be casted to a Double.- Parameters:
path- path to node (dot notation)def- default value- Returns:
- Double or default
-
getBoolean
-
getBoolean
Gets a Boolean at a location. This will either return a Boolean, or the default value. If the object at the particular location is not actually a Boolean, the default value will be returned.- Parameters:
path- path to node (dot notation)def- default value- Returns:
- Boolean or default
-
getKeys
-
getList
-
getStringList
Gets a list of Strings. Non-valid entries will not be in the list. There will be no null slots. If the list is not defined, the default will be returned. 'null' can be passed for the default, and an empty list will be returned instead. If an item in the list is not a String, it will be converted to a string. The node must be an actual list and not just a String.- Parameters:
path- path to node (dot notation)def- default value or null for an empty list as default- Returns:
- list of Strings
-
getIntList
Gets a list of integers. Non-valid entries will not be in the list. There will be no null slots. If the list is not defined, the default will be returned. 'null' can be passed for the default, and an empty list will be returned instead. The node must be an actual list and not just an integer.- Parameters:
path- path to node (dot notation)def- default value or null for an empty list as default- Returns:
- list of Integers
-
getDoubleList
Gets a list of Doubles. Non-valid entries will not be in the list. There will be no null slots. If the list is not defined, the default will be returned. 'null' can be passed for the default, and an empty list will be returned instead. The node must be an actual list and cannot be just a Double.- Parameters:
path- path to node (dot notation)def- default value or null for an empty list as default- Returns:
- list of Doubles
-
getBooleanList
Gets a list of Booleans. Non-valid entries will not be in the list. There will be no null slots. If the list is not defined, the default will be returned. 'null' can be passed for the default, and an empty list will be returned instead. The node must be an actual list and cannot be just a Boolean.- Parameters:
path- path to node (dot notation)def- default value or null for an empty list as default- Returns:
- list of Booleans
-
getVectorList
Gets a list of vectors. Non-valid entries will not be in the list. There will be no null slots. If the list is not defined, the default will be returned. 'null' can be passed for the default, and an empty list will be returned instead. The node must be an actual node and cannot be just a vector.- Parameters:
path- path to node (dot notation)def- default value or null for an empty list as default- Returns:
- list of vectors
-
getVector2List
Gets a list of 2D vectors. Non-valid entries will not be in the list. There will be no null slots. If the list is not defined, the default will be returned. 'null' can be passed for the default, and an empty list will be returned instead. The node must be an actual node and cannot be just a vector.- Parameters:
path- path to node (dot notation)def- default value or null for an empty list as default- Returns:
- list of vectors
-
getBlockVector2List
Gets a list of 2D vectors. Non-valid entries will not be in the list. There will be no null slots. If the list is not defined, the default will be returned. 'null' can be passed for the default, and an empty list will be returned instead. The node must be an actual node and cannot be just a vector.- Parameters:
path- path to node (dot notation)def- default value or null for an empty list as default- Returns:
- list of vectors
-
getNodeList
Gets a list of nodes. Non-valid entries will not be in the list. There will be no null slots. If the list is not defined, the default will be returned. 'null' can be passed for the default, and an empty list will be returned instead. The node must be an actual node and cannot be just aYAMLNode.- Parameters:
path- path to node (dot notation)def- default value or null for an empty list as default- Returns:
- list of nodes
-
getNode
-
getNodes
-
removeProperty
Remove the property at a location. This will override existing configuration data to have it conform to key/value mappings.- Parameters:
path- a path
-
writeDefaults
public boolean writeDefaults() -
setWriteDefaults
public void setWriteDefaults(boolean writeDefaults)
-