Skip to content

Commit b7a0895

Browse files
committed
fix(title): 修复组件标题颜色解析
1 parent 8d29897 commit b7a0895

4 files changed

Lines changed: 6 additions & 8 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
group=me.arasple.mc.trmenu
2-
version=3.12.2
2+
version=3.12.3

plugin/src/main/kotlin/trplugins/menu/api/action/impl/menu/SetTitle.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,8 @@ class SetTitle(handle: ActionHandle) : ActionBase(handle) {
2626
override fun onExecute(contents: ActionContents, player: ProxyPlayer, placeholderPlayer: ProxyPlayer) {
2727
val session = player.session()
2828
val receptacle = session.receptacle ?: return
29-
var title = contents.stringContent().parseContent(placeholderPlayer)
30-
title = if (useComponent) {
31-
title.colored().component().build().toRawMessage()
32-
} else {
33-
title.colorify()
29+
val title = contents.stringContent().parseContent(placeholderPlayer).colorify().let {
30+
if (useComponent) it.colored().component().build().toRawMessage() else it
3431
}
3532
receptacle.title(title)
3633
}

plugin/src/main/kotlin/trplugins/menu/module/display/Menu.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ class Menu(
238238
}
239239

240240
private fun formatTitle(title: String): String {
241-
return if (SetTitle.useComponent) title.colored().component().build().toRawMessage() else title.colorify()
241+
val coloredTitle = title.colorify()
242+
return if (SetTitle.useComponent) coloredTitle.colored().component().build().toRawMessage() else coloredTitle
242243
}
243244

244245
private fun loadIcon(session: MenuSession) {

plugin/src/main/kotlin/trplugins/menu/util/Hex.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,4 +432,4 @@ object Hex {
432432

433433
fun String.colorify() = Hex.colorify(this)
434434
fun String.parseRainbow() = Hex.parseRainbow(this)
435-
fun String.parseGradients() = Hex.parseGradients(this)
435+
fun String.parseGradients() = Hex.parseGradients(this)

0 commit comments

Comments
 (0)