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.
A chat renderer is responsible for rendering chat messages sent by
Player
s to the server.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Similar toChatRenderer
, but without knowledge of the message viewer. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ChatRenderer
Create a new instance of the defaultChatRenderer
.@NotNull net.kyori.adventure.text.Component
render(@NotNull Player source, @NotNull net.kyori.adventure.text.Component sourceDisplayName, @NotNull net.kyori.adventure.text.Component message, @NotNull net.kyori.adventure.audience.Audience viewer)
Renders a chat message.static @NotNull ChatRenderer
viewerUnaware(@NotNull ChatRenderer.ViewerUnaware renderer)
Creates a new viewer-unawareChatRenderer
, which will render the chat message a single time, displaying the same rendered message to every viewingAudience
.
-
Method Details
-
render
@NotNull @NotNull net.kyori.adventure.text.Component render(@NotNull @NotNull Player source, @NotNull @NotNull net.kyori.adventure.text.Component sourceDisplayName, @NotNull @NotNull net.kyori.adventure.text.Component message, @NotNull @NotNull net.kyori.adventure.audience.Audience viewer)Renders a chat message. This will be called once for each receivingAudience
.- Parameters:
source
- the message sourcesourceDisplayName
- the display name of the source playermessage
- the chat messageviewer
- the receivingAudience
- Returns:
- a rendered chat message
-
defaultRenderer
Create a new instance of the defaultChatRenderer
.- Returns:
- a new
ChatRenderer
-
viewerUnaware
@NotNull static @NotNull ChatRenderer viewerUnaware(@NotNull @NotNull ChatRenderer.ViewerUnaware renderer)Creates a new viewer-unawareChatRenderer
, which will render the chat message a single time, displaying the same rendered message to every viewingAudience
.- Parameters:
renderer
- the viewer unaware renderer- Returns:
- a new
ChatRenderer
-