Class CommandNode

java.lang.Object
me.efekos.simpler.commands.node.CommandNode
Direct Known Subclasses:
ArgumentNode, LabelNode

public abstract class CommandNode extends Object
Main class for nodes of CommandTrees. Every type of node should extend this class.
  • Constructor Details

    • CommandNode

      public CommandNode(CommandNode... children)
      Creates a new CommandNode.
      Parameters:
      children - Any amount of child nodes if you would like to add now. You can still add child nodes using addChild(CommandNode) later.
  • Method Details

    • getDescription

      public String getDescription()
      Returns the description of this node
      Returns:
      Description of this node
    • setDescription

      public CommandNode setDescription(String description)
      Changes the description of this node. You don't really have to set a description if this node won't have a CommandExecutive.
      Parameters:
      description - Description of this node.
      Returns:
      Itself.
    • getChildren

      public List<CommandNode> getChildren()
      Returns a list of the child nodes that this node contain.
      Returns:
      Children of this node.
    • getExecutive

      public CommandExecutive getExecutive()
      Returns a CommandExecutive to run when this node is executed by someone.
      Returns:
      Executive of this node.
    • getConsoleExecutive

      public CommandExecutive getConsoleExecutive()
      Returns a CommandExecutive to run when the console executes this node.
      Returns:
      Console-special executive of this node.
    • setConsoleExecutive

      public CommandNode setConsoleExecutive(CommandExecutive consoleExecutive)
      Changes the console-special executive of this node.
      Parameters:
      consoleExecutive - New executive to use
      Returns:
      CommandNode itself.
    • setExecutive

      public CommandNode setExecutive(CommandExecutive executive)
      Changes the executive of this node.
      Parameters:
      executive - New executive to use.
      Returns:
      CommandNode itself.
    • getParent

      public CommandNode getParent()
      Returns the parent of this node.
      Returns:
      Parent of this node.
    • setParent

      public CommandNode setParent(CommandNode parent)
      Changes the parent of this node. Please note that parents are only used for display purposes, and does not affect the command tree in any way. It is not recommended to change the parent of any node.
      Parameters:
      parent - New parent of this node.
      Returns:
      CommandNode itself.
    • addChild

      public CommandNode addChild(CommandNode node)
      Adds the given CommandNode to the children of this class and returns it.
      Parameters:
      node - New child node to add to this node.
      Returns:
      CommandNode itself.
    • addChild

      public CommandNode addChild(String label)
      Adds the given string as a LabelNode to the children of this node and returns it.
      Parameters:
      label - New label node to add to this one.
      Returns:
      CommandNode itself.
    • getPermission

      public String getPermission()
      Returns the permission that this CommandNode requires to run the executive of this node.
      Returns:
      Permission of this node.
    • setPermission

      public CommandNode setPermission(String permission)
      Changes the permission of this CommandNode and returns it.
      Parameters:
      permission - Permission that this CommandNode will require to run its executive.
      Returns:
      CommandNode itself.
    • suggest

      public abstract List<String> suggest(org.bukkit.command.CommandSender sender, List<String> args)
      Provides a list that can be added to the final list of tab completion.
      Parameters:
      sender - Sender that needs a tab completion. Probably a Player since console doesn't need a tab completion.
      args - List of the other arguments given by the sender.
      Returns:
      A list for tab completion.