3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 14:30:17 +01:00

Chat/Skin fixes (#480)

* Made MessageUtils mimic java chat behavior
Send ClientSettingsPacket when player joins a server

* Fix comments
Set use client locale instead of hard coding

* Moved chat reset to fix some broken formatting

* Revert MessageUtil as rtm516 has implemented a better fix
Dieser Commit ist enthalten in:
James Harrison 2020-05-05 03:32:37 +01:00 committet von GitHub
Ursprung b49004ddaf
Commit 5b3e7c965f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 14 neuen und 0 gelöschten Zeilen

1
.gitignore vendored
Datei anzeigen

@ -222,6 +222,7 @@ nbdist/
# End of https://www.gitignore.io/api/git,java,maven,eclipse,netbeans,jetbrains+all
### Geyser ###
run/
config.yml
logs/
public-key.pem

Datei anzeigen

@ -25,6 +25,10 @@
package org.geysermc.connector.network.translators.java;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility;
import com.github.steveice10.mc.protocol.data.game.setting.SkinPart;
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientSettingsPacket;
import org.geysermc.connector.entity.PlayerEntity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
@ -38,6 +42,9 @@ import com.nukkitx.protocol.bedrock.packet.PlayStatusPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
import java.util.Arrays;
import java.util.List;
@Translator(packet = ServerJoinGamePacket.class)
public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacket> {
@ -67,6 +74,12 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
session.setRenderDistance(packet.getViewDistance());
// We need to send our skin parts to the server otherwise java sees us with no hat, jacket etc
String locale = session.getClientData().getLanguageCode();
List<SkinPart> skinParts = Arrays.asList(SkinPart.values());
ClientSettingsPacket clientSettingsPacket = new ClientSettingsPacket(locale, (byte) session.getRenderDistance(), ChatVisibility.FULL, true, skinParts, Hand.MAIN_HAND);
session.getDownstream().getSession().send(clientSettingsPacket);
if (DimensionUtils.javaToBedrock(packet.getDimension()) != entity.getDimension()) {
DimensionUtils.switchDimension(session, packet.getDimension());
}