Class SubCommandManager
java.lang.Object
io.github.projectunified.minelib.util.subcommand.SubCommandManager
The sub-command manager
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
protected final Map<String,
SubCommand> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal @NotNull Map<String,
SubCommand> Get the available sub-commandsfinal boolean
onCommand
(@NotNull org.bukkit.command.CommandSender sender, @NotNull String label, @NotNull String... args) Execute the commandonTabComplete
(@NotNull org.bukkit.command.CommandSender sender, @NotNull String label, @NotNull String... args) Get the suggested strings when the sender use TAB key to complete the commandfinal void
registerSubcommand
(@NotNull SubCommand subCommand) Register a sub-commandvoid
sendArgNotFoundMessage
(@NotNull org.bukkit.command.CommandSender sender, @NotNull String label, @NotNull String... args) Send "Argument Not Found" messagevoid
sendHelpMessage
(@NotNull org.bukkit.command.CommandSender sender, @NotNull String label, @NotNull String... args) Send help commandfinal void
unregisterSubcommand
(@NotNull SubCommand subCommand) Unregister a sub-commandfinal void
unregisterSubcommand
(@NotNull String name) Unregister a sub-command
-
Field Details
-
HELP
- See Also:
-
subcommands
-
-
Constructor Details
-
SubCommandManager
public SubCommandManager()
-
-
Method Details
-
onCommand
public final boolean onCommand(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String label, @NotNull @NotNull String... args) Execute the command- Parameters:
sender
- the senderlabel
- the labelargs
- the arguments- Returns:
- whether the command runs successfully
-
sendHelpMessage
public void sendHelpMessage(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String label, @NotNull @NotNull String... args) Send help command- Parameters:
sender
- the senderlabel
- the labelargs
- the arguments
-
sendArgNotFoundMessage
public void sendArgNotFoundMessage(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String label, @NotNull @NotNull String... args) Send "Argument Not Found" message- Parameters:
sender
- the senderlabel
- the labelargs
- the arguments
-
registerSubcommand
Register a sub-command- Parameters:
subCommand
- the sub-command
-
unregisterSubcommand
Unregister a sub-command- Parameters:
name
- the name of the sub-command
-
unregisterSubcommand
Unregister a sub-command- Parameters:
subCommand
- the sub-command
-
getSubcommands
Get the available sub-commands- Returns:
- the unmodifiable map of sub-commands
-
onTabComplete
public final List<String> onTabComplete(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String label, @NotNull @NotNull String... args) Get the suggested strings when the sender use TAB key to complete the command- Parameters:
sender
- the senderlabel
- the labelargs
- the arguments- Returns:
- the suggested strings
-