Package me.efekos.simpler.commands
Class CommandTree
java.lang.Object
me.efekos.simpler.commands.CommandTree
Represents a command tree that can hold infinite amount of
CommandNode
s as children. You can use this to make
really complex commands with a bunch of sub commands. Use CommandManager.registerCommandTree(JavaPlugin, CommandTree)
to register a CommandTree
.-
Constructor Summary
ConstructorDescriptionCommandTree
(String baseName, String baseDescription, String basePermission) Creates a new command tree.CommandTree
(String baseName, String baseDescription, String basePermission, CommandNode... children) Creates a new command tree. -
Method Summary
Modifier and TypeMethodDescriptionAdds the given string as aLabelNode
to the children of this tree and returns it.addChild
(CommandNode node) Adds the givenCommandNode
to the children of this tree and returns it.Returns the base description that will be used by bukkit.Returns the base name that will be the main command of this tree.Returns the base permission that is needed to run ANY command under this tree.Returns a list of the child nodes that this tree contain.
-
Constructor Details
-
CommandTree
public CommandTree(String baseName, String baseDescription, String basePermission, CommandNode... children) Creates a new command tree.- Parameters:
baseName
- Base name of the command.baseDescription
- Base description of the command that will be used by spigot.basePermission
- Base permission needed to run ANY sub command under this tree.children
-CommandNode
s to add if you would like to. You can useaddChild(CommandNode)
too.
-
CommandTree
Creates a new command tree.- Parameters:
baseName
- Base name of the command.baseDescription
- Base description of the command that will be used by spigot.basePermission
- Base permission needed to run ANY sub command under this tree.
-
-
Method Details
-
getBaseDescription
Returns the base description that will be used by bukkit.- Returns:
- Description of this tree.
-
getBasePermission
Returns the base permission that is needed to run ANY command under this tree.- Returns:
- Permission of this tree.
-
getChildren
Returns a list of the child nodes that this tree contain.- Returns:
- Children of this tree.
-
getBaseName
Returns the base name that will be the main command of this tree.- Returns:
- Base name.
-
addChild
Adds the givenCommandNode
to the children of this tree and returns it.- Parameters:
node
- New child node to add to this tree.- Returns:
CommandTree
itself.
-
addChild
Adds the given string as aLabelNode
to the children of this tree and returns it.- Parameters:
label
- New label node to add to this one.- Returns:
CommandTree
itself.
-