9
0
mirror of https://github.com/Auxilor/Reforges.git synced 2025-12-24 09:29:23 +00:00

Fixed display in name

This commit is contained in:
Auxilor
2021-10-02 12:53:23 +01:00
parent 91e5f7cdfa
commit 412097d596

View File

@@ -19,6 +19,11 @@ import org.bukkit.inventory.meta.SkullMeta
@Suppress("DEPRECATION")
class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin, DisplayPriority.HIGHEST) {
private val replacement = TextReplacementConfig.builder()
.match("§w(.+)§w")
.replacement("")
.build()
override fun display(
itemStack: ItemStack,
vararg args: Any
@@ -74,10 +79,7 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin
val displayName =
(if (meta.hasDisplayName()) meta.displayName()!! else Component.translatable(itemStack))
.replaceText(
TextReplacementConfig.builder()
.match("§w(.)§w")
.replacement("")
.build()
replacement
)
val newName = StringUtils.toComponent("§w${reforge.name} §w")
.decoration(TextDecoration.ITALIC, false).append(displayName)
@@ -101,10 +103,7 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin
val displayName = meta.displayName() ?: return
meta.displayName(
displayName.replaceText(
TextReplacementConfig.builder()
.match("§w(.)§w")
.replacement("")
.build()
replacement
)
)
}