mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Fix default ChatRenderer when no plugins are installed (#5702)
This commit is contained in:
parent
de5d8a76fe
commit
ee0bafc6a3
@ -191,8 +191,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ */
|
||||
+@FunctionalInterface
|
||||
+public interface ChatRenderer {
|
||||
+ ChatRenderer DEFAULT = viewerUnaware((source, sourceDisplayName, message) -> Component.translatable("chat.type.text", sourceDisplayName, message));
|
||||
+
|
||||
+ /**
|
||||
+ * Renders a chat message. This will be called once for each receiving {@link Audience}.
|
||||
+ *
|
||||
@ -206,6 +204,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ Component render(@NotNull Player source, @NotNull Component sourceDisplayName, @NotNull Component message, @NotNull Audience viewer);
|
||||
+
|
||||
+ /**
|
||||
+ * Create a new instance of the default {@link ChatRenderer}.
|
||||
+ *
|
||||
+ * @return a new {@link ChatRenderer}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ static ChatRenderer defaultRenderer() {
|
||||
+ return viewerUnaware((source, sourceDisplayName, message) -> Component.translatable("chat.type.text", sourceDisplayName, message));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new viewer-unaware {@link ChatRenderer}, which will render the chat message a single time,
|
||||
+ * displaying the same rendered message to every viewing {@link Audience}.
|
||||
+ *
|
||||
|
@ -189,7 +189,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // no legacy events called, all nice and fresh!
|
||||
+ () -> {
|
||||
+ this.processModern(
|
||||
+ ChatRenderer.DEFAULT,
|
||||
+ ChatRenderer.defaultRenderer(),
|
||||
+ new LazyPlayerSet(this.server),
|
||||
+ Component.text(this.message).replaceText(URL_REPLACEMENT_CONFIG),
|
||||
+ false
|
||||
|
Loading…
Reference in New Issue
Block a user