Package ch.njol.skript.config
Class SectionNode
java.lang.Object
ch.njol.skript.config.Node
ch.njol.skript.config.SectionNode
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given node at the end of this section.voidconvertToEntries(int levels)Converts all SimpleNodes in this section to EntryNodes.voidconvertToEntries(int levels, String separator)REMIND breaks saving - separator argument can be different from config.sepator@Nullable NodeGets a subnode (EntryNode or SectionNode) with the specified name.Gets an entry's value or the default value if it doesn't exist or is not an EntryNode.@Nullable StringvoidInserts the given node into this section at the specified position.booleanisEmpty()iterator()Iterator over all non-void nodes of this section.voidRemoves the given node from this section.@Nullable NodeRemoves an entry with the given key.voidsave(PrintWriter w)voidvoidbooleansetValues(SectionNode other, String... excluded)intsize()booleanvalidate(SectionValidator validator)Methods inherited from class ch.njol.skript.config.Node
debug, getComment, getConfig, getIndentation, getKey, getLine, getParent, isVoid, move, remove, rename, save, splitLine, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SectionNode
-
-
Method Details
-
size
public int size()- Returns:
- Total amount of nodes (including void nodes) in this section.
-
add
Adds the given node at the end of this section.- Parameters:
n-
-
insert
Inserts the given node into this section at the specified position.- Parameters:
n-index- between 0 andsize(), inclusive
-
remove
Removes the given node from this section.- Parameters:
n-
-
remove
Removes an entry with the given key.- Parameters:
key-- Returns:
- The removed node, or null if the key didn't match any node.
-
iterator
Iterator over all non-void nodes of this section. -
get
Gets a subnode (EntryNode or SectionNode) with the specified name.- Parameters:
key-- Returns:
- The node with the given name
-
getValue
-
get
Gets an entry's value or the default value if it doesn't exist or is not an EntryNode.- Parameters:
name- The name of the node (case insensitive)def- The default value- Returns:
- The value of the entry node with the give node, or def if there's no entry with the given name.
-
set
-
set
-
isEmpty
public boolean isEmpty() -
convertToEntries
public void convertToEntries(int levels)Converts all SimpleNodes in this section to EntryNodes.- Parameters:
levels- Amount of levels to go down, e.g. 0 to only convert direct subnodes of this section or -1 for all subnodes including subnodes of subnodes etc.
-
convertToEntries
REMIND breaks saving - separator argument can be different from config.sepator- Parameters:
levels- Maximum depth of recursion, -1 for no limit.separator- Some separator, e.g. ":" or "=".
-
save
-
validate
-
setValues
- Parameters:
other-excluded- keys and sections to exclude- Returns:
- false if this and the other SectionNode contain the exact same set of keys
-