Interface ItemTranslationProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A provider that supplies custom MiniMessage strings dynamically for translatable keys in items.
This interface is used to inject custom text representations directly into an item's name or lore via code.
-
Method Summary
Modifier and TypeMethodDescription@Nullable Stringresolve(@NotNull String key, @NotNull org.bukkit.inventory.ItemStack item, @Nullable org.bukkit.entity.Player player, @NotNull ItemTranslationContext context) Resolves a custom MiniMessage string for the given translation key, item, and player within the specified context.
-
Method Details
-
resolve
@Nullable @Nullable String resolve(@NotNull @NotNull String key, @NotNull @NotNull org.bukkit.inventory.ItemStack item, @Nullable @Nullable org.bukkit.entity.Player player, @NotNull @NotNull ItemTranslationContext context) Resolves a custom MiniMessage string for the given translation key, item, and player within the specified context.- Parameters:
key- The translation key being resolved (e.g., "component.lore.item_level").item- The item stack currently being translated.player- The player viewing the item, or null if unavailable.context- The specific context (name, custom name, or lore) where this translation is applied.- Returns:
- A MiniMessage string representing the resolved text, or null if this provider doesn't handle the given key.
-