Package io.papermc.paper.chat

# Interface ChatRenderer

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ChatRenderer
A chat renderer is responsible for rendering chat messages sent by `Player`s to the server.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`ChatRenderer.ViewerUnaware`
Similar to `ChatRenderer`, but without knowledge of the message viewer.

## Method Summary

Modifier and Type
Method
Description
`static @NotNull ChatRenderer`
`defaultRenderer()`
Create a new instance of the default `ChatRenderer`.
`@NotNull Component`
`render(@NotNull Player source, @NotNull Component sourceDisplayName, @NotNull Component message, @NotNull Audience viewer)`
Renders a chat message.
`static @NotNull ChatRenderer`
`viewerUnaware(@NotNull ChatRenderer.ViewerUnaware renderer)`
Creates a new viewer-unaware `ChatRenderer`, which will render the chat message a single time, displaying the same rendered message to every viewing `Audience`.

## Method Details

### render

@OverrideOnly @NotNull @NotNull Component render(@NotNull @NotNull Player source, @NotNull @NotNull Component sourceDisplayName, @NotNull @NotNull Component message, @NotNull @NotNull Audience viewer)
Renders a chat message. This will be called once for each receiving `Audience`.

Parameters:
  `source` - the message source
  `sourceDisplayName` - the display name of the source player
  `message` - the chat message
  `viewer` - the receiving `Audience`
Returns:
  a rendered chat message

### defaultRenderer

@NotNull static @NotNull ChatRenderer defaultRenderer()
Create a new instance of the default `ChatRenderer`.

Returns:
  a new `ChatRenderer`

### viewerUnaware

@NotNull static @NotNull ChatRenderer viewerUnaware(@NotNull @NotNull ChatRenderer.ViewerUnaware renderer)
Creates a new viewer-unaware `ChatRenderer`, which will render the chat message a single time, displaying the same rendered message to every viewing `Audience`.

Parameters:
  `renderer` - the viewer unaware renderer
Returns:
  a new `ChatRenderer`