3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Revert sending actionbar messages as jukebox, avoid pink system chat overlays (#4066)

System chat overlays too aren't pink anymore - they're still sent as jukebox for better visibility though.
Dieser Commit ist enthalten in:
chris 2023-09-07 09:07:42 +02:00 committet von GitHub
Ursprung 3ec591509c
Commit acf24d4d6b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 13 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -29,6 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSy
import net.kyori.adventure.text.TranslatableComponent;
import org.cloudburstmc.protocol.bedrock.packet.TextPacket;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.ChatColor;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
@ -55,7 +56,11 @@ public class JavaSystemChatTranslator extends PacketTranslator<ClientboundSystem
textPacket.setType(packet.isOverlay() ? TextPacket.Type.JUKEBOX_POPUP : TextPacket.Type.SYSTEM);
textPacket.setNeedsTranslation(false);
textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.locale()));
if (packet.isOverlay()) {
textPacket.setMessage(ChatColor.WHITE + MessageTranslator.convertMessage(packet.getContent(), session.locale()));
} else {
textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.locale()));
}
if (session.isSentSpawnPacket()) {
session.sendUpstreamPacket(textPacket);

Datei anzeigen

@ -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.TextPacket;
import org.cloudburstmc.protocol.bedrock.packet.SetTitlePacket;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
@ -44,14 +44,11 @@ public class JavaSetActionBarTextTranslator extends PacketTranslator<Clientbound
text = MessageTranslator.convertMessage(packet.getText(), session.locale());
}
// 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);
SetTitlePacket titlePacket = new SetTitlePacket();
titlePacket.setType(SetTitlePacket.Type.ACTIONBAR);
titlePacket.setText(text);
titlePacket.setXuid("");
titlePacket.setPlatformOnlineId("");
session.sendUpstreamPacket(titlePacket);
}
}