Interface Commander

  • All Superinterfaces:
    net.kyori.adventure.audience.Audience, net.kyori.adventure.audience.ForwardingAudience, net.kyori.adventure.audience.ForwardingAudience.Single

    public interface Commander
    extends net.kyori.adventure.audience.ForwardingAudience.Single
    An actor that can perform commands and receive messages.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface net.kyori.adventure.audience.ForwardingAudience

        net.kyori.adventure.audience.ForwardingAudience.Single
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default <C extends net.kyori.adventure.text.BuildableComponent<C,​B>,​B extends net.kyori.adventure.text.ComponentBuilder<C,​B>>
      B
      callback​(B builder, Consumer<Commander> callback)
      Adds a click event to the provided component builder
      default void checkPermission​(Permission permission)  
      default void checkPermission​(String permission)  
      default void checkSubjectPermission​(String basePermission, ca.stellardrift.permissionsex.subject.SubjectRef<?> subject)
      Check a permission specialized for a certain subject type.
      default void debug​(net.kyori.adventure.text.ComponentLike text)
      Send debug text.
      default void error​(net.kyori.adventure.text.ComponentLike text)
      Send an error message.
      default void error​(net.kyori.adventure.text.ComponentLike text, @Nullable Throwable error)
      Send an error message to the client.
      MessageFormatter formatter()
      A formatter providing formatting options for messages sent to this commander.
      default boolean hasPermission​(Permission permission)  
      boolean hasPermission​(String permission)
      Get whether this commander has a certain permission.
      net.kyori.adventure.text.Component name()
      The display name for the actor, to be used in any potential action logging.
      default void sendMessage​(@NonNull net.kyori.adventure.identity.Identified source, @NonNull net.kyori.adventure.text.Component message, @NonNull net.kyori.adventure.audience.MessageType type)
      default void sendMessage​(@NonNull net.kyori.adventure.identity.Identity source, @NonNull net.kyori.adventure.text.Component message, @NonNull net.kyori.adventure.audience.MessageType type)
      default void sendPaginated​(net.kyori.adventure.text.ComponentLike title, @Nullable net.kyori.adventure.text.ComponentLike header, Collection<? extends net.kyori.adventure.text.ComponentLike> lines)
      Send a paginated list to the user.
      default void sendPaginated​(net.kyori.adventure.text.ComponentLike title, @Nullable net.kyori.adventure.text.ComponentLike header, Stream<? extends net.kyori.adventure.text.ComponentLike> lines)
      Send a paginated list to the user.
      default void sendPaginated​(net.kyori.adventure.text.ComponentLike title, Collection<? extends net.kyori.adventure.text.ComponentLike> lines)
      Send a paginated list to the user.
      default void sendPaginated​(net.kyori.adventure.text.ComponentLike title, Stream<? extends net.kyori.adventure.text.ComponentLike> lines)
      Send a paginated list to the user.
      @Nullable ca.stellardrift.permissionsex.subject.SubjectRef<?> subjectIdentifier()
      A reference to the subject used
      • Methods inherited from interface net.kyori.adventure.audience.Audience

        openBook, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter
      • Methods inherited from interface net.kyori.adventure.audience.ForwardingAudience.Single

        audience, audiences, clearTitle, hideBossBar, openBook, playSound, playSound, resetTitle, sendActionBar, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, showBossBar, showTitle, stopSound
    • Method Detail

      • name

        net.kyori.adventure.text.Component name()
        The display name for the actor, to be used in any potential action logging.
        Returns:
        the name
      • subjectIdentifier

        @Nullable ca.stellardrift.permissionsex.subject.SubjectRef<?> subjectIdentifier()
        A reference to the subject used
        Returns:
        a subject identifier
      • hasPermission

        boolean hasPermission​(String permission)
        Get whether this commander has a certain permission.

        This result might not match checking the subject identified by subjectIdentifier() due to additional context that may be present in command execution.

        Parameters:
        permission - the permission to test
        Returns:
        whether this subject has a certain permission
      • checkSubjectPermission

        default void checkSubjectPermission​(String basePermission,
                                            ca.stellardrift.permissionsex.subject.SubjectRef<?> subject)
                                     throws CommandException
        Check a permission specialized for a certain subject type.
        Parameters:
        basePermission - the base permission to use
        subject - the specific subject to validate
        Throws:
        CommandException - thrown if the permission check fails
      • sendMessage

        default void sendMessage​(@NonNull net.kyori.adventure.identity.Identified source,
                                 @NonNull net.kyori.adventure.text.Component message,
                                 @NonNull net.kyori.adventure.audience.MessageType type)

        The message should be colored the appropriate output colour if it does not yet have a colour

        Specified by:
        sendMessage in interface net.kyori.adventure.audience.Audience
        Specified by:
        sendMessage in interface net.kyori.adventure.audience.ForwardingAudience
        Specified by:
        sendMessage in interface net.kyori.adventure.audience.ForwardingAudience.Single
      • sendMessage

        default void sendMessage​(@NonNull net.kyori.adventure.identity.Identity source,
                                 @NonNull net.kyori.adventure.text.Component message,
                                 @NonNull net.kyori.adventure.audience.MessageType type)

        The message should be colored the appropriate output colour if it does not yet have a colour

        Specified by:
        sendMessage in interface net.kyori.adventure.audience.Audience
        Specified by:
        sendMessage in interface net.kyori.adventure.audience.ForwardingAudience
        Specified by:
        sendMessage in interface net.kyori.adventure.audience.ForwardingAudience.Single
      • debug

        default void debug​(net.kyori.adventure.text.ComponentLike text)
        Send debug text.
        Parameters:
        text - the text that will be sent
      • error

        default void error​(net.kyori.adventure.text.ComponentLike text)
        Send an error message.
        Parameters:
        text - the error message
      • error

        default void error​(net.kyori.adventure.text.ComponentLike text,
                           @Nullable Throwable error)
        Send an error message to the client.
        Parameters:
        text - the message to send
        error - an exception to optionally expose as a hover event on the message.
      • sendPaginated

        default void sendPaginated​(net.kyori.adventure.text.ComponentLike title,
                                   Collection<? extends net.kyori.adventure.text.ComponentLike> lines)
        Send a paginated list to the user.
        Parameters:
        title - a title
        lines - the lines to send
      • sendPaginated

        default void sendPaginated​(net.kyori.adventure.text.ComponentLike title,
                                   @Nullable net.kyori.adventure.text.ComponentLike header,
                                   Collection<? extends net.kyori.adventure.text.ComponentLike> lines)
        Send a paginated list to the user.
        Parameters:
        title - a title
        header - a header/subtitle
        lines - the lines to send
      • sendPaginated

        default void sendPaginated​(net.kyori.adventure.text.ComponentLike title,
                                   Stream<? extends net.kyori.adventure.text.ComponentLike> lines)
        Send a paginated list to the user.
        Parameters:
        title - a title
        lines - the lines to send
      • sendPaginated

        default void sendPaginated​(net.kyori.adventure.text.ComponentLike title,
                                   @Nullable net.kyori.adventure.text.ComponentLike header,
                                   Stream<? extends net.kyori.adventure.text.ComponentLike> lines)
        Send a paginated list to the user.
        Parameters:
        title - a title
        header - a header/subtitle
        lines - the lines to send
      • callback

        default <C extends net.kyori.adventure.text.BuildableComponent<C,​B>,​B extends net.kyori.adventure.text.ComponentBuilder<C,​B>> B callback​(B builder,
                                                                                                                                                                   Consumer<Commander> callback)
        Adds a click event to the provided component builder
        Parameters:
        callback - The function to call
        Returns:
        The updated text