send system chat overlay and actionbar as jukebox_popup messages (#3941)

* send actionbar and systemchat overlay messages as jukebox text to avoid clashes with armor/air UI

* add explaining comment
This commit is contained in:
chris 2023-07-30 01:51:16 +02:00 committed by GitHub
parent 3949fb1988
commit d147ee37dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View file

@ -52,7 +52,7 @@ public class JavaSystemChatTranslator extends PacketTranslator<ClientboundSystem
textPacket.setPlatformChatId("");
textPacket.setSourceName("");
textPacket.setXuid(session.getAuthData().xuid());
textPacket.setType(packet.isOverlay() ? TextPacket.Type.TIP : TextPacket.Type.SYSTEM);
textPacket.setType(packet.isOverlay() ? TextPacket.Type.JUKEBOX_POPUP : TextPacket.Type.SYSTEM);
textPacket.setNeedsTranslation(false);
textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.locale()));

View file

@ -26,7 +26,7 @@
package org.geysermc.geyser.translator.protocol.java.title;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetActionBarTextPacket;
import org.cloudburstmc.protocol.bedrock.packet.SetTitlePacket;
import org.cloudburstmc.protocol.bedrock.packet.TextPacket;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
@ -44,11 +44,14 @@ public class JavaSetActionBarTextTranslator extends PacketTranslator<Clientbound
text = MessageTranslator.convertMessage(packet.getText(), session.locale());
}
SetTitlePacket titlePacket = new SetTitlePacket();
titlePacket.setType(SetTitlePacket.Type.ACTIONBAR);
titlePacket.setText(text);
titlePacket.setXuid("");
titlePacket.setPlatformOnlineId("");
session.sendUpstreamPacket(titlePacket);
// Type seems wrong, but is intentional to avoid collisions with armor/remaining air bars
TextPacket textPacket = new TextPacket();
textPacket.setType(TextPacket.Type.JUKEBOX_POPUP);
textPacket.setNeedsTranslation(false);
textPacket.setSourceName("");
textPacket.setMessage(text);
textPacket.setXuid("");
textPacket.setPlatformChatId("");
session.sendUpstreamPacket(textPacket);
}
}