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

Check for instance of TranslationMessage (#722)

Checks for class of custom name ID in case it's translation message.
Dieser Commit ist enthalten in:
Camotoy 2020-06-02 10:45:33 -04:00 committet von GitHub
Ursprung 05024dde8c
Commit 18891a22f1
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -34,6 +34,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
import com.github.steveice10.mc.protocol.data.message.TextMessage;
import com.github.steveice10.mc.protocol.data.message.TranslationMessage;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket;
import com.nukkitx.math.vector.Vector3f;
@ -253,9 +254,15 @@ public class Entity {
}
break;
case 2: // custom name
TextMessage name = (TextMessage) entityMetadata.getValue();
if (name != null)
metadata.put(EntityData.NAMETAG, MessageUtils.getBedrockMessage(name));
if (entityMetadata.getValue() instanceof TextMessage) {
TextMessage name = (TextMessage) entityMetadata.getValue();
if (name != null)
metadata.put(EntityData.NAMETAG, MessageUtils.getBedrockMessage(name));
} else if (entityMetadata.getValue() instanceof TranslationMessage) {
TranslationMessage message = (TranslationMessage) entityMetadata.getValue();
if (message != null)
metadata.put(EntityData.NAMETAG, MessageUtils.getTranslatedBedrockMessage(message, session.getClientData().getLanguageCode(), true));
}
break;
case 3: // is custom name visible
if (!this.is(PlayerEntity.class))