Class Node

java.lang.Object
ch.njol.skript.config.Node
Direct Known Subclasses:
EntryNode, SectionNode, SimpleNode, VoidNode

public abstract class Node extends Object
  • Field Details

    • key

      protected @Nullable String key
    • comment

      protected String comment
    • lineNum

      protected final int lineNum
    • parent

      protected @Nullable SectionNode parent
    • config

      protected Config config
  • Constructor Details

  • Method Details

    • getKey

      public @Nullable String getKey()
      Key of this node. null for empty or invalid nodes, and the config's main node.
    • getConfig

      public final Config getConfig()
    • rename

      public void rename(String newname)
    • move

      public void move(SectionNode newParent)
    • splitLine

      public static NonNullPair<String,String> splitLine(String line)
      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 -
      Returns:
      A pair (value, comment).
    • getComment

      protected @Nullable String getComment()
    • getIndentation

      protected String getIndentation()
    • save

      public final String save()
    • save

      public void save(PrintWriter w)
    • getParent

      public @Nullable SectionNode 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

      public String toString()
      returns information about this node which looks like the following:
      node value #including comments (config.sk, line xyz)
      Overrides:
      toString in class Object
    • debug

      public boolean debug()