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

java.lang.Object
me.lucyy.squirtgun.command.node.SubcommandNode<T>
All Implemented Interfaces:
CommandNode<T>

public class SubcommandNode<T extends me.lucyy.squirtgun.platform.PermissionHolder>
extends java.lang.Object
implements CommandNode<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
    Constructor Description
    SubcommandNode​(@NotNull java.lang.String name, @Nullable java.lang.String permission, boolean addHelpNode, @NotNull CommandNode<T>... childNodes)  
  • Method Summary

    Modifier and Type Method Description
    @Nullable net.kyori.adventure.text.Component execute​(CommandContext<T> context)
    Execute this node.
    @NotNull java.util.List<CommandArgument<?>> getArguments()
    Gets this command's arguments.
    java.lang.String getDescription()
    Gets this node's description for use in help commands.
    @NotNull java.lang.String getName()
    Gets this node's name, which will be used as a literal if needed.
    java.util.Set<? extends CommandNode<T>> getNodes()
    Gets the child nodes that this node holds.
    @Nullable java.lang.String getPermission()
    Gets the permission needed to execute this node or any children.
    @Nullable CommandNode<T> next​(CommandContext<T> context)
    Returns the node following this node.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SubcommandNode

      @SafeVarargs public SubcommandNode​(@NotNull @NotNull java.lang.String name, @Nullable @Nullable java.lang.String permission, boolean addHelpNode, @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.
      addHelpNode - whether or not to add a SubcommandHelpNode with the name "help" to the list
      childNodes - the child nodes
  • Method Details

    • 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.
      Specified by:
      getArguments in interface CommandNode<T extends me.lucyy.squirtgun.platform.PermissionHolder>
    • getNodes

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

      @Nullable public @Nullable CommandNode<T> next​(CommandContext<T> context)
      Description copied from interface: CommandNode
      Returns the node following this node.
      Specified by:
      next in interface CommandNode<T extends me.lucyy.squirtgun.platform.PermissionHolder>
      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.
      Specified by:
      execute in interface CommandNode<T extends me.lucyy.squirtgun.platform.PermissionHolder>
      Parameters:
      context - the context that this command was executed in
      Returns:
      a component to optionally
    • getName

      @NotNull public @NotNull java.lang.String getName()
      Description copied from interface: CommandNode
      Gets this node's name, which will be used as a literal if needed.
      Specified by:
      getName in interface CommandNode<T extends me.lucyy.squirtgun.platform.PermissionHolder>
    • getDescription

      public java.lang.String getDescription()
      Description copied from interface: CommandNode
      Gets this node's description for use in help commands. This should be a simple, one-line sentence.
      Specified by:
      getDescription in interface CommandNode<T extends me.lucyy.squirtgun.platform.PermissionHolder>
    • getPermission

      @Nullable public @Nullable java.lang.String getPermission()
      Description copied from interface: CommandNode
      Gets the permission needed to execute this node or any children.
      Specified by:
      getPermission in interface CommandNode<T extends me.lucyy.squirtgun.platform.PermissionHolder>
      Returns:
      the permission, or null if no permission is needed