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]
52
52
check(translator !=null) {
53
53
"Addon does not have a translator; did you forget to call registerWithPylon()?"
54
54
}
55
55
56
56
// Adventure is a perfect API with absolutely no problems whatsoever.
57
57
val name = schema.itemStack.getData(DataComponentTypes.ITEM_NAME) as?TranslatableComponent
58
-
val lore = schema.itemStack.getData(DataComponentTypes.LORE)?.lines()?.get(0) as?TranslatableComponent
59
58
60
-
varisNameAndLoreValid=true
59
+
varisNameValid=true
61
60
if (name ==null|| name.key() !=ItemStackBuilder.nameKey(schema.key)) {
62
61
PylonCore.logger.warning("Item ${schema.key}'s name is not a translation key; check your item uses ItemStackBuilder.pylonItem(...)")
63
-
isNameAndLoreValid=false
62
+
isNameValid=false
64
63
}
65
64
66
-
if (lore ==null|| lore.key() !=ItemStackBuilder.loreKey(schema.key)) {
67
-
PylonCore.logger.warning("Item ${schema.key}'s lore is not a translation key; check your item uses ItemStackBuilder.pylonItem(...)")
68
-
isNameAndLoreValid =false
69
-
}
70
-
71
-
if (isNameAndLoreValid) {
65
+
if (isNameValid) {
72
66
for (locale in schema.addon.languages) {
73
67
if (!translator.translationKeyExists(name!!.key(), locale)) {
74
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)}")
75
69
}
76
-
if (!translator.translationKeyExists(lore!!.key(), locale)) {
77
-
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)}")
78
-
}
79
70
}
80
71
}
81
72
}
82
73
83
74
privatefunregister(schema:PylonItemSchema) {
84
-
if (schema.key !innameAndLoreWarningsSupressed) {
85
-
checkNameAndLore(schema)
75
+
if (schema.key !innameWarningsSupressed) {
76
+
checkName(schema)
86
77
}
87
78
PylonRegistry.ITEMS.register(schema)
88
79
}
@@ -116,8 +107,8 @@ open class PylonItem(val stack: ItemStack) : Keyed {
0 commit comments