mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 07:17:46 +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
|
+@FunctionalInterface
|
||||||
+public interface ChatRenderer {
|
+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}.
|
+ * 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);
|
+ 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,
|
+ * 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}.
|
+ * 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!
|
+ // no legacy events called, all nice and fresh!
|
||||||
+ () -> {
|
+ () -> {
|
||||||
+ this.processModern(
|
+ this.processModern(
|
||||||
+ ChatRenderer.DEFAULT,
|
+ ChatRenderer.defaultRenderer(),
|
||||||
+ new LazyPlayerSet(this.server),
|
+ new LazyPlayerSet(this.server),
|
||||||
+ Component.text(this.message).replaceText(URL_REPLACEMENT_CONFIG),
|
+ Component.text(this.message).replaceText(URL_REPLACEMENT_CONFIG),
|
||||||
+ false
|
+ false
|
||||||
|
Loading…
Reference in New Issue
Block a user