Package ch.njol.skript.config
Class Node
java.lang.Object
ch.njol.skript.config.Node
- Direct Known Subclasses:
EntryNode
,SectionNode
,SimpleNode
,VoidNode
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
Node
(String key, SectionNode parent) protected
Node
(String key, String comment, SectionNode parent, int lineNum) -
Method Summary
Modifier and TypeMethodDescriptionboolean
debug()
protected @Nullable String
final Config
protected String
@Nullable String
getKey()
Key of this node.int
getLine()
@Nullable SectionNode
boolean
isVoid()
void
move
(SectionNode newParent) void
remove()
Removes this node from its parent.void
final String
save()
void
save
(PrintWriter w) static NonNullPair
<String, String> Splits a line into value and comment.static NonNullPair
<String, String> splitLine
(String line, AtomicBoolean inBlockComment) Splits a line into value and comment.toString()
returns information about this node which looks like the following:
node value #including comments (config.sk, line xyz)
-
Field Details
-
key
-
comment
-
lineNum
protected final int lineNum -
parent
-
config
-
-
Constructor Details
-
Node
-
Node
-
Node
-
-
Method Details
-
getKey
Key of this node. null for empty or invalid nodes, and the config's main node. -
getConfig
-
rename
-
move
-
splitLine
Splits a line into value and comment.Whitespace is preserved (whitespace in front of the comment is added to the value), and any ## in the value are replaced by a single #. The comment is returned with a leading #, except if there is no comment in which case it will be the empty string.
- Parameters:
line
- the line to split- Returns:
- A pair (value, comment).
-
splitLine
Splits a line into value and comment.Whitespace is preserved (whitespace in front of the comment is added to the value), and any ## not in quoted strings in the value are replaced by a single #. The comment is returned with a leading #, except if there is no comment in which case it will be the empty string.
- Parameters:
line
- the line to splitinBlockComment
- Whether we are currently inside a block comment- Returns:
- A pair (value, comment).
-
getComment
-
getIndentation
-
save
-
save
-
getParent
-
remove
public void remove()Removes this node from its parent. Does nothing if this node does not have a parent node. -
getLine
public int getLine()- Returns:
- Original line of this node at the time it was loaded. -1 if this node was created dynamically.
-
isVoid
public boolean isVoid()- Returns:
- Whether this node does not hold information (i.e. is empty or invalid)
-
toString
returns information about this node which looks like the following:
node value #including comments (config.sk, line xyz)
-
debug
public boolean debug()
-