Package io.papermc.paper.chat
Interface ChatRenderer
- All Known Subinterfaces:
ChatRenderer.Default
- 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
static interface
Similar toChatRenderer
, but without knowledge of the message viewer. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ChatRenderer
Create a new instance of the defaultChatRenderer
.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-unawareChatRenderer
, which will render the chat message a single time, displaying the same rendered message to every viewingAudience
.
-
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 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
-