Class CommandTree

java.lang.Object
me.efekos.simpler.commands.CommandTree

public class CommandTree extends Object
Represents a command tree that can hold infinite amount of CommandNodes as children. You can use this to make really complex commands with a bunch of sub commands. Use CommandManager.registerCommandTree(JavaPlugin, CommandTree) to register a CommandTree.
  • Constructor Details

    • CommandTree

      public CommandTree(String baseName, String baseDescription, String basePermission, CommandNode... children)
      Creates a new command tree.
      Parameters:
      baseName - Base name of the command.
      baseDescription - Base description of the command that will be used by spigot.
      basePermission - Base permission needed to run ANY sub command under this tree.
      children - CommandNodes to add if you would like to. You can use addChild(CommandNode) too.
    • CommandTree

      public CommandTree(String baseName, String baseDescription, String basePermission)
      Creates a new command tree.
      Parameters:
      baseName - Base name of the command.
      baseDescription - Base description of the command that will be used by spigot.
      basePermission - Base permission needed to run ANY sub command under this tree.
  • Method Details

    • getBaseDescription

      public String getBaseDescription()
      Returns the base description that will be used by bukkit.
      Returns:
      Description of this tree.
    • getBasePermission

      public String getBasePermission()
      Returns the base permission that is needed to run ANY command under this tree.
      Returns:
      Permission of this tree.
    • getChildren

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

      public String getBaseName()
      Returns the base name that will be the main command of this tree.
      Returns:
      Base name.
    • addChild

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

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