Package me.lucyy.squirtgun.command.node
Interface CommandNode<T extends me.lucyy.squirtgun.platform.audience.PermissionHolder>
-
- Type Parameters:
T- the type of object to pass in command context
- All Known Implementing Classes:
AbstractNode,HelpNode,PluginInfoNode,SubcommandHelpNode,SubcommandNode
public interface CommandNode<T extends me.lucyy.squirtgun.platform.audience.PermissionHolder>A node as part of a command chain.- Since:
- 2.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods 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 Detail
-
execute
@Nullable @Nullable net.kyori.adventure.text.Component execute(CommandContext<T> context)
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
@NotNull default @NotNull java.util.List<CommandArgument<?>> getArguments()
Gets this command's arguments. By default, returns an empty list.
-
next
@Nullable default @Nullable CommandNode<T> next(CommandContext<T> context)
Returns the node following this node.- Returns:
- the next node in the chain, or if this is the end of the chain, null
-
-