Class SubcommandNode<T extends me.lucyy.squirtgun.platform.audience.PermissionHolder>

  • All Implemented Interfaces:
    CommandNode<T>

    public class SubcommandNode<T extends me.lucyy.squirtgun.platform.audience.PermissionHolder>
    extends AbstractNode<T>
    A node that tab completes and acts as a "splitter" for other nodes. As per the name, it can be used to create subcommands.
    Since:
    2.0.0
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected SubcommandNode​(@NotNull java.lang.String name, @NotNull java.lang.String description, @Nullable java.lang.String permission, @NotNull CommandNode<T>... childNodes)  
    • Constructor Detail

      • SubcommandNode

        @SafeVarargs
        protected SubcommandNode​(@NotNull
                                 @NotNull java.lang.String name,
                                 @NotNull
                                 @NotNull java.lang.String description,
                                 @Nullable
                                 @Nullable java.lang.String permission,
                                 @NotNull
                                 @NotNull CommandNode<T>... childNodes)
        Parameters:
        name - this node's name.
        permission - the permission needed to execute this node. May be null if none is required.
        childNodes - the child nodes
    • Method Detail

      • withHelp

        @SafeVarargs
        public static <T extends me.lucyy.squirtgun.platform.audience.PermissionHolder> SubcommandNode<T> withHelp​(java.lang.String name,
                                                                                                                   java.lang.String description,
                                                                                                                   @Nullable
                                                                                                                   @Nullable java.lang.String permission,
                                                                                                                   @NotNull
                                                                                                                   @NotNull CommandNode<T>... childNodes)
        Creates a node with an advanced help node.
        Parameters:
        name - this node's name
        description - this node's description
        permission - the permission needed to execute this node. May be null if none is required
        childNodes - the child nodes
        Returns:
        a new SubcommandNode
      • withFallback

        @SafeVarargs
        public static <T extends me.lucyy.squirtgun.platform.audience.PermissionHolder> SubcommandNode<T> withFallback​(java.lang.String name,
                                                                                                                       java.lang.String description,
                                                                                                                       @Nullable
                                                                                                                       @Nullable java.lang.String permission,
                                                                                                                       @NotNull
                                                                                                                       @NotNull CommandNode<T> fallback,
                                                                                                                       @NotNull
                                                                                                                       @NotNull CommandNode<T>... childNodes)
        Creates a node with a custom default node.
        Parameters:
        name - this node's name
        description - this node's description
        permission - the permission needed to execute this node. May be null if none is required
        fallback - the node to use if no valid subcommand is specified
        childNodes - the child nodes
        Returns:
        a new SubcommandNode
      • withBasicHelp

        @SafeVarargs
        public static <T extends me.lucyy.squirtgun.platform.audience.PermissionHolder> SubcommandNode<T> withBasicHelp​(java.lang.String name,
                                                                                                                        java.lang.String description,
                                                                                                                        @Nullable
                                                                                                                        @Nullable java.lang.String permission,
                                                                                                                        @NotNull
                                                                                                                        @NotNull CommandNode<T>... childNodes)
        Creates a node with a basic help node.
        Parameters:
        name - this node's name
        description - this node's description
        permission - the permission needed to execute this node. May be null if none is required
        childNodes - the child nodes
        Returns:
        a new SubcommandNode
      • getNodes

        public java.util.Set<? extends CommandNode<T>> getNodes()
        Gets the child nodes that this node holds.
      • getFallbackNode

        @Nullable
        public @Nullable CommandNode<T> getFallbackNode()
        Gets the fallback node.
      • getArguments

        @NotNull
        public @NotNull java.util.List<CommandArgument<?>> getArguments()
        Description copied from interface: CommandNode
        Gets this command's arguments. By default, returns an empty list.
      • next

        @Nullable
        public @Nullable CommandNode<T> next​(CommandContext<T> context)
        Description copied from interface: CommandNode
        Returns the node following this node.
        Returns:
        the next node in the chain, or if this is the end of the chain, null
      • execute

        @Nullable
        public @Nullable net.kyori.adventure.text.Component execute​(CommandContext<T> context)
        Description copied from interface: CommandNode
        Execute this node. This will only be executed if there are no further nodes in the chain.
        Parameters:
        context - the context that this command was executed in
        Returns:
        a component to optionally