3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Fix 1.11.1 -> 1.12 show_achievement translation (#2120)

Dieser Commit ist enthalten in:
RK_01 2020-10-12 13:32:06 +02:00 committet von GitHub
Ursprung 0015682fe4
Commit 71341a9381
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -27,8 +27,15 @@ public class TranslateRewriter {
return;
}
String value = hoverEvent.getAsJsonPrimitive("value").getAsString();
if (AchievementTranslationMapping.get(value) == null) {
String textValue;
JsonElement value = hoverEvent.get("value");
if (value.isJsonObject()) {
textValue = value.getAsJsonObject().get("text").getAsString();
} else {
textValue = value.getAsJsonPrimitive().getAsString();
}
if (AchievementTranslationMapping.get(textValue) == null) {
JsonObject invalidText = new JsonObject();
invalidText.addProperty("text", "Invalid statistic/achievement!");
invalidText.addProperty("color", "red");
@ -48,17 +55,17 @@ public class TranslateRewriter {
baseArray.add(namePart);
baseArray.add(newLine);
baseArray.add(typePart);
if (value.startsWith("achievement")) {
namePart.addProperty("translate", value);
namePart.addProperty("color", AchievementTranslationMapping.isSpecial(value) ? "dark_purple" : "green");
if (textValue.startsWith("achievement")) {
namePart.addProperty("translate", textValue);
namePart.addProperty("color", AchievementTranslationMapping.isSpecial(textValue) ? "dark_purple" : "green");
typePart.addProperty("translate", "stats.tooltip.type.achievement");
JsonObject description = new JsonObject();
typePart.addProperty("italic", true);
description.addProperty("translate", value + ".desc");
baseArray.add(newLine);
baseArray.add(description);
} else if (value.startsWith("stat")) {
namePart.addProperty("translate", value);
} else if (textValue.startsWith("stat")) {
namePart.addProperty("translate", textValue);
namePart.addProperty("color", "gray");
typePart.addProperty("translate", "stats.tooltip.type.statistic");
typePart.addProperty("italic", true);