SPIGOT-7349: Player#setDisplayName not working when message/format unmodified

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-07-28 18:56:00 +10:00
parent 1b9d617ddc
commit 223ea107d2
2 changed files with 16 additions and 48 deletions

View File

@@ -1,26 +0,0 @@
--- a/net/minecraft/network/chat/ChatMessageType.java
+++ b/net/minecraft/network/chat/ChatMessageType.java
@@ -2,6 +2,7 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
+import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
import net.minecraft.commands.CommandListenerWrapper;
@@ -27,6 +28,7 @@
public static final ResourceKey<ChatMessageType> TEAM_MSG_COMMAND_INCOMING = create("team_msg_command_incoming");
public static final ResourceKey<ChatMessageType> TEAM_MSG_COMMAND_OUTGOING = create("team_msg_command_outgoing");
public static final ResourceKey<ChatMessageType> EMOTE_COMMAND = create("emote_command");
+ public static final ResourceKey<ChatMessageType> RAW = create("raw"); // CraftBukkit
private static ResourceKey<ChatMessageType> create(String s) {
return ResourceKey.create(Registries.CHAT_TYPE, new MinecraftKey(s));
@@ -40,6 +42,7 @@
bootstapcontext.register(ChatMessageType.TEAM_MSG_COMMAND_INCOMING, new ChatMessageType(ChatDecoration.teamMessage("chat.type.team.text"), ChatDecoration.withSender("chat.type.text.narrate")));
bootstapcontext.register(ChatMessageType.TEAM_MSG_COMMAND_OUTGOING, new ChatMessageType(ChatDecoration.teamMessage("chat.type.team.sent"), ChatDecoration.withSender("chat.type.text.narrate")));
bootstapcontext.register(ChatMessageType.EMOTE_COMMAND, new ChatMessageType(ChatDecoration.withSender("chat.type.emote"), ChatDecoration.withSender("chat.type.emote")));
+ bootstapcontext.register(ChatMessageType.RAW, new ChatMessageType(new ChatDecoration("%s", List.of(ChatDecoration.a.CONTENT), ChatModifier.EMPTY), new ChatDecoration("%s", List.of(ChatDecoration.a.CONTENT), ChatModifier.EMPTY))); // CraftBukkit
}
public static ChatMessageType.a bind(ResourceKey<ChatMessageType> resourcekey, Entity entity) {