aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt4
3 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt
index 035a166bb..b5108c6ac 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt
@@ -13,8 +13,10 @@ import at.hannibal2.skyhanni.features.bingo.BingoAPI
import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
import at.hannibal2.skyhanni.features.misc.compacttablist.AdvancedPlayerList
+import at.hannibal2.skyhanni.utils.ChatUtils.changeColor
import at.hannibal2.skyhanni.utils.ComponentMatcherUtils.matchStyledMatcher
import at.hannibal2.skyhanni.utils.ComponentSpan
+import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.StringUtils.applyFormattingFrom
@@ -140,7 +142,10 @@ class PlayerNameFormatter {
level = event.levelComponent
)
)
- appendSibling(event.action.intoComponent())
+
+ appendText(" ")
+ appendSibling(event.action.intoComponent().changeColor(LorenzColor.GRAY))
+
appendText(" ")
appendSibling(event.item.intoComponent())
}) ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
index d1dce7fe3..728fa667b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
@@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.chat.Text.prefix
import at.hannibal2.skyhanni.utils.chat.Text.url
import net.minecraft.client.Minecraft
import net.minecraft.util.ChatComponentText
+import net.minecraft.util.ChatStyle
import net.minecraft.util.IChatComponent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.LinkedList
@@ -268,4 +269,11 @@ object ChatUtils {
}
)
}
+
+ fun IChatComponent.changeColor(color: LorenzColor): IChatComponent {
+ chatStyle = ChatStyle().also {
+ it.color = color.toChatFormatting()
+ }
+ return this
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt
index bb9ab0c03..8309a8f86 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.test.command.ErrorManager
import net.minecraft.item.EnumDyeColor
+import net.minecraft.util.EnumChatFormatting
import java.awt.Color
enum class LorenzColor(val chatColorCode: Char, private val color: Color, private val coloredLabel: String) {
@@ -62,6 +63,9 @@ enum class LorenzColor(val chatColorCode: Char, private val color: Color, privat
CHROMA -> EnumDyeColor.WHITE
}
+ fun toChatFormatting(): EnumChatFormatting? =
+ EnumChatFormatting.entries.firstOrNull { it.toString() == getChatColor() }
+
companion object {
fun EnumDyeColor.toLorenzColor() = when (this) {