From 3e067350ae1c1c74979dc2a5c2266b9466502a84 Mon Sep 17 00:00:00 2001 From: ybw0014 Date: Sun, 10 May 2026 12:55:32 -0400 Subject: [PATCH] feat(RebarTranslator): apply white color to item names if not set --- .../kotlin/io/github/pylonmc/rebar/i18n/RebarTranslator.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rebar/src/main/kotlin/io/github/pylonmc/rebar/i18n/RebarTranslator.kt b/rebar/src/main/kotlin/io/github/pylonmc/rebar/i18n/RebarTranslator.kt index d133beacd..5827528ad 100644 --- a/rebar/src/main/kotlin/io/github/pylonmc/rebar/i18n/RebarTranslator.kt +++ b/rebar/src/main/kotlin/io/github/pylonmc/rebar/i18n/RebarTranslator.kt @@ -20,6 +20,7 @@ import io.papermc.paper.datacomponent.item.ItemLore import io.papermc.paper.datacomponent.item.ResolvableProfile import net.kyori.adventure.key.Key import net.kyori.adventure.text.* +import net.kyori.adventure.text.format.NamedTextColor import net.kyori.adventure.text.format.Style import net.kyori.adventure.translation.GlobalTranslator import net.kyori.adventure.translation.Translator @@ -218,12 +219,14 @@ class RebarTranslator private constructor(private val addon: RebarAddon) : Trans } val translated = GlobalTranslator.render(it.withArguments(concatenatedArguments), locale) - if (translated is TranslatableComponent && translated.fallback() != null) { + val result = if (translated is TranslatableComponent && translated.fallback() != null) { Component.text(translated.fallback()!!) } else { translated } + // apply white color if not set + if (result.style().color() == null) result.color(NamedTextColor.WHITE) else result } editData(DataComponentTypes.LORE) { lore -> val newLore = lore.lines().flatMap { line -> @@ -284,4 +287,4 @@ class RebarTranslator private constructor(private val addon: RebarAddon) : Trans private val Material.isPotion: Boolean get() = this == Material.POTION || this == Material.SPLASH_POTION || - this == Material.LINGERING_POTION || this == Material.TIPPED_ARROW \ No newline at end of file + this == Material.LINGERING_POTION || this == Material.TIPPED_ARROW