Skip to content

Commit 1d6c4eb

Browse files
authored
TextBuilder: Fix style append order
Color codes reset the formatting, so they need to be appended before the formatting codes. Linear: EM-3315 GitHub: #119
1 parent 01ea578 commit 1d6c4eb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/kotlin/gg/essential/universal/utils/textUtils.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ import net.minecraft.util.IChatComponent
2929
//$$ private fun formatString(style: Style): String {
3030
//$$ val builder = StringBuilder("§r")
3131
//$$
32+
//$$ style.color?.let(colorToFormatChar::get)?.let {
33+
//$$ builder.append(it)
34+
//$$ }
35+
//$$
3236
//$$ when {
3337
//$$ style.bold -> builder.append("§l")
3438
//$$ style.italic -> builder.append("§o")
@@ -37,9 +41,6 @@ import net.minecraft.util.IChatComponent
3741
//$$ style.obfuscated -> builder.append("§k")
3842
//$$ }
3943
//$$
40-
//$$ style.color?.let(colorToFormatChar::get)?.let {
41-
//$$ builder.append(it)
42-
//$$ }
4344
//$$ return builder.toString()
4445
//$$ }
4546
//$$

0 commit comments

Comments
 (0)