Class MessageFormatter

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static net.kyori.adventure.text.format.TextColor DEFAULT_HIGHLIGHT_COLOR  
      static net.kyori.adventure.text.format.TextColor DEFAULT_MESSAGE_COLOR  
      static net.kyori.adventure.text.Component EQUALS_SIGN  
      static net.kyori.adventure.text.Component SLASH  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <C extends net.kyori.adventure.text.BuildableComponent<C,​B>,​B extends net.kyori.adventure.text.ComponentBuilder<C,​B>>
      net.kyori.adventure.text.Component
      button​(B builder, ButtonType type, @Nullable net.kyori.adventure.text.ComponentLike tooltip, String command, boolean execute)
      Create a clickable button that will execute a command or suggest a command to be executed
      protected <I> @Nullable String friendlyName​(ca.stellardrift.permissionsex.subject.SubjectRef<I> reference)  
      <C extends net.kyori.adventure.text.BuildableComponent<C,​B>,​B extends net.kyori.adventure.text.ComponentBuilder<C,​B>>
      B
      header​(B builder)  
      net.kyori.adventure.text.format.Style.Builder header​(net.kyori.adventure.text.format.Style.Builder builder)  
      net.kyori.adventure.text.format.TextColor highlightColor()
      The color to be used for highlighted parts of messages.
      <C extends net.kyori.adventure.text.BuildableComponent<C,​B>,​B extends net.kyori.adventure.text.ComponentBuilder<C,​B>>
      B
      hl​(B builder)  
      net.kyori.adventure.text.format.Style.Builder hl​(net.kyori.adventure.text.format.Style.Builder builder)  
      net.kyori.adventure.text.format.TextColor responseColor()
      Get the colour to be used for standard command responses.
      net.kyori.adventure.text.Component subject​(ca.stellardrift.permissionsex.subject.CalculatedSubject subject)  
      <I> net.kyori.adventure.text.Component subject​(ca.stellardrift.permissionsex.subject.SubjectRef<I> subject)
      Print the subject in a user-friendly manner.
      protected String transformCommand​(String cmd)
      Given a command in standard format, correct it to refer to specifically the proxy format.
    • Field Detail

      • DEFAULT_MESSAGE_COLOR

        public static final net.kyori.adventure.text.format.TextColor DEFAULT_MESSAGE_COLOR
      • EQUALS_SIGN

        public static final net.kyori.adventure.text.Component EQUALS_SIGN
      • SLASH

        public static final net.kyori.adventure.text.Component SLASH
    • Constructor Detail

      • MessageFormatter

        public MessageFormatter​(MinecraftPermissionsEx<?> manager)
        Create a new formatter with default message and highlight colours.
        Parameters:
        manager - the permissions manager
      • MessageFormatter

        public MessageFormatter​(MinecraftPermissionsEx<?> manager,
                                net.kyori.adventure.text.format.TextColor messageColor,
                                net.kyori.adventure.text.format.TextColor highlightColor)
    • Method Detail

      • responseColor

        public final net.kyori.adventure.text.format.TextColor responseColor()
        Get the colour to be used for standard command responses.
        Returns:
        the response color
      • highlightColor

        public final net.kyori.adventure.text.format.TextColor highlightColor()
        The color to be used for highlighted parts of messages.
        Returns:
        the highlight color
      • transformCommand

        protected String transformCommand​(String cmd)
        Given a command in standard format, correct it to refer to specifically the proxy format.
        Parameters:
        cmd - the original command
        Returns:
        the transformed command
      • friendlyName

        protected <I> @Nullable String friendlyName​(ca.stellardrift.permissionsex.subject.SubjectRef<I> reference)
      • subject

        public final net.kyori.adventure.text.Component subject​(ca.stellardrift.permissionsex.subject.CalculatedSubject subject)
      • subject

        public <I> net.kyori.adventure.text.Component subject​(ca.stellardrift.permissionsex.subject.SubjectRef<I> subject)
        Print the subject in a user-friendly manner. May link to the subject info printout
        Parameters:
        subject - The subject to show
        Returns:
        the formatted value
      • button

        public <C extends net.kyori.adventure.text.BuildableComponent<C,​B>,​B extends net.kyori.adventure.text.ComponentBuilder<C,​B>> net.kyori.adventure.text.Component button​(B builder,
                                                                                                                                                                                                 ButtonType type,
                                                                                                                                                                                                 @Nullable net.kyori.adventure.text.ComponentLike tooltip,
                                                                                                                                                                                                 String command,
                                                                                                                                                                                                 boolean execute)
        Create a clickable button that will execute a command or suggest a command to be executed
        Parameters:
        type - The style of button to present
        tooltip - A tooltip to optionally show when hovering over a button
        command - The command to execute
        execute - Whether the command provided will be executed or only added to the user's input
        Returns:
        the formatted text
      • header

        public final <C extends net.kyori.adventure.text.BuildableComponent<C,​B>,​B extends net.kyori.adventure.text.ComponentBuilder<C,​B>> B header​(B builder)
      • hl

        public final <C extends net.kyori.adventure.text.BuildableComponent<C,​B>,​B extends net.kyori.adventure.text.ComponentBuilder<C,​B>> B hl​(B builder)
      • header

        public final net.kyori.adventure.text.format.Style.Builder header​(net.kyori.adventure.text.format.Style.Builder builder)
      • hl

        public final net.kyori.adventure.text.format.Style.Builder hl​(net.kyori.adventure.text.format.Style.Builder builder)