You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val translator =AddonTranslator.translators[schema.addon]
46
+
check(translator !=null) {
47
+
"Addon does not have a translator; did you forget to call registerWithPylon()?"
48
+
}
49
+
50
+
// Adventure is a perfect API with absolutely no problems whatsoever.
51
+
val name = schema.itemStack.getData(DataComponentTypes.ITEM_NAME) as?TranslatableComponent
52
+
val lore = schema.itemStack.getData(DataComponentTypes.LORE)?.lines()?.get(0) as?TranslatableComponent
53
+
54
+
var isNameAndLoreValid =true
55
+
if (name ==null|| name.key() !=ItemStackBuilder.nameKey(schema.key)) {
56
+
PylonCore.logger.warning("Item ${schema.key}'s name is not a translation key; check your item uses ItemStackBuilder.pylonItem(...)")
57
+
isNameAndLoreValid =false
58
+
}
59
+
60
+
if (lore ==null|| lore.key() !=ItemStackBuilder.loreKey(schema.key)) {
61
+
PylonCore.logger.warning("Item ${schema.key}'s lore is not a translation key; check your item uses ItemStackBuilder.pylonItem(...)")
62
+
isNameAndLoreValid =false
63
+
}
64
+
65
+
if (isNameAndLoreValid) {
66
+
for (locale in schema.addon.languages) {
67
+
if (!translator.translationKeyExists(name!!.key(), locale)) {
68
+
PylonCore.logger.warning("${schema.key.namespace} is missing a name translation key for item ${schema.key} (locale: ${locale.displayName} | expected translation key: ${ItemStackBuilder.nameKey(schema.key)}")
69
+
}
70
+
if (!translator.translationKeyExists(lore!!.key(), locale)) {
71
+
PylonCore.logger.warning("${schema.key.namespace} is missing a lore translation key for item ${schema.key} (locale: ${locale.displayName} | expected translation key: ${ItemStackBuilder.loreKey(schema.key)}")
0 commit comments