-
Notifications
You must be signed in to change notification settings - Fork 0
Command creation
The class is an advanced abstraction for managing commands in Minecraft. It extends CommandExecutor and TabCompleter, offering additional methods to customize commands, subcommands, arguments, and handlers.
-
getName()
Returns the name of the command. -
getPermission()
Returns the permission required to execute the command. -
getPermissionMessage()
Returns the message displayed when the player lacks the required permission. -
getCommand()
Returns theCommandobject associated with this command. -
getAliases()
Returns a list of aliases (shortcuts) for the command.
All methods return the ICommand object, allowing method chaining.
-
description(String description)
Sets the command description. -
label(String label)
Sets the command label. -
permission(String permission)
Sets the required permission. -
permissionMessage(String permissionMessage)
Sets the message displayed when permission is denied. -
usage(String usage)
Defines the usage template for the command. -
addAlias(String alias)
Adds a single alias to the command. -
addAliases(String... aliases)
Adds multiple aliases to the command.
-
getSubCommands()
Returns a map of subcommands (Map<String, ICommand>). -
getSubCommand(String subCommandName)
Retrieves a specific subcommand by its name. -
subCommand(ICommand subCommand)
Adds a single subcommand. -
subCommands(ICommand... subCommands)
Adds multiple subcommands.
-
getArguments()
Returns a list of arguments (List<Argument<?>>). -
getArgument(String argumentName)
Retrieves a specific argument by its name. -
argument(Argument<T> argument)
Adds a single argument to the command. -
arguments(Argument<?>... arguments)
Adds multiple arguments to the command.
-
getExecutors()
Returns a list of command executors. -
getCompleters()
Returns a list of tab completers. -
execute(CommandExecutor executor)
Adds a command execution handler. -
complete(TabCompleter completer)
Adds a tab completion handler.
new AdvancedCommand(”test”)
.description("Example command")
.label("example")
.permission("example.use")
.permissionMessage("You don't have permission!")
.addAlias("ex")
.argument(new StringArgument("player"))
.execute((sender, args) -> {
sender.sendMessage("Command executed!");
return true;
})
.complete((sender, args) -> List.of("player1", "player2")).register();• Simplifies the setup and management of commands with method chaining.
• Easily supports adding subcommands and arguments.
• Separates execution and tab completion logic for better organization.