mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Quick fix for NPE in SystemChatTranslator
This won't matter in 1.19.1 so.
This commit is contained in:
parent
b2b544c3a8
commit
13e8b59ed0
1 changed files with 6 additions and 1 deletions
|
@ -28,6 +28,7 @@ package org.geysermc.geyser.translator.protocol.java;
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.TextPacket;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.text.ChatTypeEntry;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.Translator;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
|
@ -37,11 +38,15 @@ public class JavaSystemChatTranslator extends PacketTranslator<ClientboundSystem
|
|||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundSystemChatPacket packet) {
|
||||
ChatTypeEntry chatTypeEntry = session.getChatTypes().get(packet.getTypeId());
|
||||
// This probably isn't proper but system chat won't care about the registry in 1.19.1 anyway
|
||||
TextPacket.Type chatType = chatTypeEntry == null ? TextPacket.Type.RAW : chatTypeEntry.bedrockChatType();
|
||||
|
||||
TextPacket textPacket = new TextPacket();
|
||||
textPacket.setPlatformChatId("");
|
||||
textPacket.setSourceName("");
|
||||
textPacket.setXuid(session.getAuthData().xuid());
|
||||
textPacket.setType(session.getChatTypes().get(packet.getTypeId()).bedrockChatType());
|
||||
textPacket.setType(chatType);
|
||||
|
||||
textPacket.setNeedsTranslation(false);
|
||||
textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.getLocale()));
|
||||
|
|
Loading…
Reference in a new issue