Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()!!)
Comment thread
ybw0014 marked this conversation as resolved.
} 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 ->
Expand Down Expand Up @@ -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
this == Material.LINGERING_POTION || this == Material.TIPPED_ARROW
Loading