mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00: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.
This commit is contained in:
parent
3ec591509c
commit
acf24d4d6b
2 changed files with 13 additions and 11 deletions
|
@ -29,6 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSy
|
||||||
import net.kyori.adventure.text.TranslatableComponent;
|
import net.kyori.adventure.text.TranslatableComponent;
|
||||||
import org.cloudburstmc.protocol.bedrock.packet.TextPacket;
|
import org.cloudburstmc.protocol.bedrock.packet.TextPacket;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
|
import org.geysermc.geyser.text.ChatColor;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
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;
|
||||||
|
@ -55,7 +56,11 @@ public class JavaSystemChatTranslator extends PacketTranslator<ClientboundSystem
|
||||||
textPacket.setType(packet.isOverlay() ? TextPacket.Type.JUKEBOX_POPUP : TextPacket.Type.SYSTEM);
|
textPacket.setType(packet.isOverlay() ? TextPacket.Type.JUKEBOX_POPUP : TextPacket.Type.SYSTEM);
|
||||||
|
|
||||||
textPacket.setNeedsTranslation(false);
|
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()) {
|
if (session.isSentSpawnPacket()) {
|
||||||
session.sendUpstreamPacket(textPacket);
|
session.sendUpstreamPacket(textPacket);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
package org.geysermc.geyser.translator.protocol.java.title;
|
package org.geysermc.geyser.translator.protocol.java.title;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetActionBarTextPacket;
|
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.session.GeyserSession;
|
||||||
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;
|
||||||
|
@ -44,14 +44,11 @@ public class JavaSetActionBarTextTranslator extends PacketTranslator<Clientbound
|
||||||
text = MessageTranslator.convertMessage(packet.getText(), session.locale());
|
text = MessageTranslator.convertMessage(packet.getText(), session.locale());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type seems wrong, but is intentional to avoid collisions with armor/remaining air bars
|
SetTitlePacket titlePacket = new SetTitlePacket();
|
||||||
TextPacket textPacket = new TextPacket();
|
titlePacket.setType(SetTitlePacket.Type.ACTIONBAR);
|
||||||
textPacket.setType(TextPacket.Type.JUKEBOX_POPUP);
|
titlePacket.setText(text);
|
||||||
textPacket.setNeedsTranslation(false);
|
titlePacket.setXuid("");
|
||||||
textPacket.setSourceName("");
|
titlePacket.setPlatformOnlineId("");
|
||||||
textPacket.setMessage(text);
|
session.sendUpstreamPacket(titlePacket);
|
||||||
textPacket.setXuid("");
|
|
||||||
textPacket.setPlatformChatId("");
|
|
||||||
session.sendUpstreamPacket(textPacket);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue