forked from GeyserMC/Geyser
Added translation to bossbar titles
This commit is contained in:
parent
d8ff735626
commit
1abc0f9764
2 changed files with 6 additions and 2 deletions
|
@ -51,7 +51,7 @@ public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket>
|
|||
|
||||
bossEventPacket.setAction(BossEventPacket.Action.SHOW);
|
||||
bossEventPacket.setBossUniqueEntityId(entityId);
|
||||
bossEventPacket.setTitle(MessageUtils.getBedrockMessage(packet.getTitle()));
|
||||
bossEventPacket.setTitle(MessageUtils.getTranslatedBedrockMessage(packet.getTitle(), session.getClientData().getLanguageCode()));
|
||||
bossEventPacket.setHealthPercentage(packet.getHealth());
|
||||
bossEventPacket.setColor(0); //ignored by client
|
||||
bossEventPacket.setOverlay(1);
|
||||
|
@ -59,7 +59,7 @@ public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket>
|
|||
break;
|
||||
case UPDATE_TITLE:
|
||||
bossEventPacket.setAction(BossEventPacket.Action.TITLE);
|
||||
bossEventPacket.setTitle(MessageUtils.getBedrockMessage(packet.getTitle()));
|
||||
bossEventPacket.setTitle(MessageUtils.getTranslatedBedrockMessage(packet.getTitle(), session.getClientData().getLanguageCode()));
|
||||
break;
|
||||
case UPDATE_HEALTH:
|
||||
bossEventPacket.setAction(BossEventPacket.Action.HEALTH_PERCENTAGE);
|
||||
|
|
|
@ -108,6 +108,10 @@ public class MessageUtils {
|
|||
return builder.toString();
|
||||
}
|
||||
|
||||
public static String getTranslatedBedrockMessage(Message message, String locale) {
|
||||
return getTranslatedBedrockMessage(message, locale, true);
|
||||
}
|
||||
|
||||
public static String getBedrockMessage(Message message) {
|
||||
return getTranslatedBedrockMessage(message, null, false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue