Class StandardHelpHandler<C>

java.lang.Object
org.incendo.cloud.help.StandardHelpHandler<C>
All Implemented Interfaces:
HelpHandler<C>

@API(status=STABLE) public class StandardHelpHandler<C> extends Object implements HelpHandler<C>
  • Constructor Details

    • StandardHelpHandler

      public StandardHelpHandler(@NonNull CommandManager<C> commandManager, @NonNull CommandPredicate<C> commandPredicate)
      Creates a new help handler.
      Parameters:
      commandManager - the command manager to get commands from
      commandPredicate - filter that determines which commands are applicable
  • Method Details

    • query

      public @NonNull HelpQueryResult<C> query(@NonNull HelpQuery<C> query)
      Handles the given query and returns the result.

      If nothing matched the query, an empty IndexCommandResult will be returned.

      Specified by:
      query in interface HelpHandler<C>
      Parameters:
      query - the query
      Returns:
      the result
    • commands

      protected @NonNull List<@NonNull CommandEntry<C>> commands(@NonNull C sender)
      Returns entries for all commands that are applicable to this handler.
      Parameters:
      sender - the sender of the query
      Returns:
      the help entries
    • isNodeVisible

      protected boolean isNodeVisible(@NonNull CommandNode<C> node)
      Checks using the predicate whether a command node or one of its children is visible
      Parameters:
      node - the node
      Returns:
      true if the node is visible, false if it isn't