Class SubCommandManager

java.lang.Object
io.github.projectunified.minelib.util.subcommand.SubCommandManager

public class SubCommandManager extends Object
The sub-command manager
  • Field Details

  • 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 sender
      label - the label
      args - 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 sender
      label - the label
      args - 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 sender
      label - the label
      args - the arguments
    • registerSubcommand

      public final void registerSubcommand(@NotNull @NotNull SubCommand subCommand)
      Register a sub-command
      Parameters:
      subCommand - the sub-command
    • unregisterSubcommand

      public final void unregisterSubcommand(@NotNull @NotNull String name)
      Unregister a sub-command
      Parameters:
      name - the name of the sub-command
    • unregisterSubcommand

      public final void unregisterSubcommand(@NotNull @NotNull SubCommand subCommand)
      Unregister a sub-command
      Parameters:
      subCommand - the sub-command
    • getSubcommands

      @NotNull public final @NotNull Map<String,SubCommand> 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 sender
      label - the label
      args - the arguments
      Returns:
      the suggested strings