Interface CommandTreeNode<T extends CommandTreeNode<T>>

    • Method Detail

      • root

        static CommandTreeNode<CommandTreeNode.Root> root()
        Creates a root node for the tree.

        The return value is in an 'intermediate' state, where it must have additional information supplied to become a useful part of the command tree. The node should be at least one of executable() or taking an argument, and may have other attributes applied.

        Returns:
        The root node.
      • literal

        static CommandTreeNode<CommandTreeNode.Basic> literal()
        Creates a node that uses its key as a literal.

        The return value is in an 'intermediate' state, where it must have additional information supplied to become a useful part of the command tree. The node should be at least one of executable() or taking an argument, and may have other attributes applied.

        Returns:
        The literal.
      • child

        T child​(String key,
                CommandTreeNode.Argument<?> childNode)
        Creates a child of this node with the given key that accepts a non-literal argument.

        The builder returned by this method is the same builder as that invoked on. The child builder is provided in the childNode node.

        Parameters:
        key - The name of the child node
        childNode - The child node
        Returns:
        This, for chaining.
        See Also:
        for the node types that can be created
      • child

        default <C extends CommandTreeNode.Argument<C>> T child​(String key,
                                                                DefaultedRegistryReference<CommandTreeNodeType<C>> type,
                                                                Consumer<C> processor)
        Creates a child of this node with the given key that accepts a non-literal argument.

        The builder returned by this method is the same builder as that invoked on. The child builder is provided in the childNode node.

        This variant will create a new node based on the provided key and allow for processing before adding the node as a child

        Type Parameters:
        C - The type of CommandTreeNode.Argument to be created
        Parameters:
        key - The name of the child node
        type - the type of argument to use in the child node
        processor - A callback that will receive the created child node
        Returns:
        This, for chaining.
        See Also:
        for the node types that can be created
      • child

        default <C extends CommandTreeNode.Argument<C>> T child​(String key,
                                                                CommandTreeNodeType<C> type,
                                                                Consumer<C> processor)
        Creates a child of this node with the given key that accepts a non-literal argument.

        The builder returned by this method is the same builder as that invoked on. The child builder is provided in the childNode node.

        This variant will create a new node based on the provided key and allow for processing before adding the node as a child

        Type Parameters:
        C - The type of CommandTreeNode.Argument to be created
        Parameters:
        key - The name of the child node
        type - the type of argument to use in the child node
        processor - A callback that will receive the created child node
        Returns:
        This, for chaining.
        See Also:
        for the node types that can be created
      • redirect

        T redirect​(CommandTreeNode<?> redirectTarget)
        Declares that this element will redirect processing to the given node in this tree after this node has been processed.

        The node that is provided here will not be executed and will not be checked to see if its requirements are met. This node will act as if its has the target node's children.

        Parameters:
        redirectTarget - The node to redirect to
        Returns:
        This, for chaining
      • requires

        T requires​(@Nullable Predicate<CommandCause> requirement)
        Declares that this element can only be parsed by those with the given requirement.
        Parameters:
        requirement - The requirement
        Returns:
        This, for chaining
      • executable

        T executable()
        Declares that the node this CommandTreeNode represents is executable, meaning that a command string that stops here is considered complete.
        Returns:
        This, for chaining
      • customCompletions

        T customCompletions()
        Declares that this node uses custom completions and, as such, tab completions should query the server.

        This overrides completions(CommandCompletionProvider).

        Returns:
        This, for chaining.