Files
CatServer/patches/net/minecraft/network/play/server/SPacketChat.java.patch
2019-02-24 22:29:41 +08:00

41 lines
1.2 KiB
Diff

--- ../src-base/minecraft/net/minecraft/network/play/server/SPacketChat.java
+++ ../src-work/minecraft/net/minecraft/network/play/server/SPacketChat.java
@@ -13,6 +13,7 @@
{
private ITextComponent chatComponent;
private ChatType type;
+ public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot
public SPacketChat()
{
@@ -29,6 +30,14 @@
this.type = type;
}
+ // CatServer start
+ public SPacketChat(ITextComponent message, byte type)
+ {
+ this.chatComponent = message;
+ this.type = ChatType.byId(type);
+ }
+ // CatServer end
+
public void readPacketData(PacketBuffer buf) throws IOException
{
this.chatComponent = buf.readTextComponent();
@@ -37,7 +46,13 @@
public void writePacketData(PacketBuffer buf) throws IOException
{
- buf.writeTextComponent(this.chatComponent);
+ // Spigot start
+ if (components != null) {
+ buf.writeString(net.md_5.bungee.chat.ComponentSerializer.toString(components));
+ } else {
+ buf.writeTextComponent(this.chatComponent);
+ }
+ // Spigot end
buf.writeByte(this.type.getId());
}