Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 16:40:14 +01:00
Quick fix for NPE in SystemChatTranslator
This won't matter in 1.19.1 so.
Dieser Commit ist enthalten in:
Ursprung
b2b544c3a8
Commit
13e8b59ed0
@ -28,6 +28,7 @@ package org.geysermc.geyser.translator.protocol.java;
|
|||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.TextPacket;
|
import com.nukkitx.protocol.bedrock.packet.TextPacket;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
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.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||||
@ -37,11 +38,15 @@ public class JavaSystemChatTranslator extends PacketTranslator<ClientboundSystem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, ClientboundSystemChatPacket packet) {
|
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 textPacket = new TextPacket();
|
||||||
textPacket.setPlatformChatId("");
|
textPacket.setPlatformChatId("");
|
||||||
textPacket.setSourceName("");
|
textPacket.setSourceName("");
|
||||||
textPacket.setXuid(session.getAuthData().xuid());
|
textPacket.setXuid(session.getAuthData().xuid());
|
||||||
textPacket.setType(session.getChatTypes().get(packet.getTypeId()).bedrockChatType());
|
textPacket.setType(chatType);
|
||||||
|
|
||||||
textPacket.setNeedsTranslation(false);
|
textPacket.setNeedsTranslation(false);
|
||||||
textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.getLocale()));
|
textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.getLocale()));
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren