Package me.lucyy.squirtgun.command.node
Interface CommandNode<T extends me.lucyy.squirtgun.platform.PermissionHolder>
- Type Parameters:
T- the type of object to pass in command context
- All Known Implementing Classes:
HelpNode,PluginInfoNode,SubcommandHelpNode,SubcommandNode
public interface CommandNode<T extends me.lucyy.squirtgun.platform.PermissionHolder>
A node as part of a command chain.
- Since:
- 2.0.0
-
Method Summary
Modifier and Type Method Description @Nullable net.kyori.adventure.text.Componentexecute(CommandContext<T> context)Execute this node.default @NotNull java.util.List<CommandArgument<?>>getArguments()Gets this command's arguments.java.lang.StringgetDescription()Gets this node's description for use in help commands.@NotNull java.lang.StringgetName()Gets this node's name, which will be used as a literal if needed.default @Nullable java.lang.StringgetPermission()Gets the permission needed to execute this node or any children.default @Nullable CommandNode<T>next(CommandContext<T> context)Returns the node following this node.
-
Method Details
-
execute
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
-
getName
@NotNull @NotNull java.lang.String getName()Gets this node's name, which will be used as a literal if needed. -
getDescription
java.lang.String getDescription()Gets this node's description for use in help commands. This should be a simple, one-line sentence. -
getPermission
@Nullable default @Nullable java.lang.String getPermission()Gets the permission needed to execute this node or any children.- Returns:
- the permission, or null if no permission is needed
-
getArguments
Gets this command's arguments. By default, returns an empty list. -
next
Returns the node following this node.- Returns:
- the next node in the chain, or if this is the end of the chain, null
-