Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Merge pull request #314 from rtm516/bossbar-title-fix
Added translation to bossbar titles
Dieser Commit ist enthalten in:
Commit
3d462e9d02
@ -51,7 +51,7 @@ public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket>
|
|||||||
|
|
||||||
bossEventPacket.setAction(BossEventPacket.Action.SHOW);
|
bossEventPacket.setAction(BossEventPacket.Action.SHOW);
|
||||||
bossEventPacket.setBossUniqueEntityId(entityId);
|
bossEventPacket.setBossUniqueEntityId(entityId);
|
||||||
bossEventPacket.setTitle(MessageUtils.getBedrockMessage(packet.getTitle()));
|
bossEventPacket.setTitle(MessageUtils.getTranslatedBedrockMessage(packet.getTitle(), session.getClientData().getLanguageCode()));
|
||||||
bossEventPacket.setHealthPercentage(packet.getHealth());
|
bossEventPacket.setHealthPercentage(packet.getHealth());
|
||||||
bossEventPacket.setColor(0); //ignored by client
|
bossEventPacket.setColor(0); //ignored by client
|
||||||
bossEventPacket.setOverlay(1);
|
bossEventPacket.setOverlay(1);
|
||||||
@ -59,7 +59,7 @@ public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket>
|
|||||||
break;
|
break;
|
||||||
case UPDATE_TITLE:
|
case UPDATE_TITLE:
|
||||||
bossEventPacket.setAction(BossEventPacket.Action.TITLE);
|
bossEventPacket.setAction(BossEventPacket.Action.TITLE);
|
||||||
bossEventPacket.setTitle(MessageUtils.getBedrockMessage(packet.getTitle()));
|
bossEventPacket.setTitle(MessageUtils.getTranslatedBedrockMessage(packet.getTitle(), session.getClientData().getLanguageCode()));
|
||||||
break;
|
break;
|
||||||
case UPDATE_HEALTH:
|
case UPDATE_HEALTH:
|
||||||
bossEventPacket.setAction(BossEventPacket.Action.HEALTH_PERCENTAGE);
|
bossEventPacket.setAction(BossEventPacket.Action.HEALTH_PERCENTAGE);
|
||||||
|
@ -108,6 +108,10 @@ public class MessageUtils {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getTranslatedBedrockMessage(Message message, String locale) {
|
||||||
|
return getTranslatedBedrockMessage(message, locale, true);
|
||||||
|
}
|
||||||
|
|
||||||
public static String getBedrockMessage(Message message) {
|
public static String getBedrockMessage(Message message) {
|
||||||
return getTranslatedBedrockMessage(message, null, false);
|
return getTranslatedBedrockMessage(message, null, false);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren