diff options
Diffstat (limited to 'src/main')
4 files changed, 35 insertions, 20 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/markedplayer/MarkedPlayerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/markedplayer/MarkedPlayerConfig.java index 431e5f29c..264474b96 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/markedplayer/MarkedPlayerConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/markedplayer/MarkedPlayerConfig.java @@ -1,7 +1,9 @@ package at.hannibal2.skyhanni.config.features.markedplayer; +import at.hannibal2.skyhanni.utils.LorenzColor; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; import io.github.moulberry.moulconfig.annotations.ConfigOption; import io.github.moulberry.moulconfig.observer.Property; @@ -21,4 +23,10 @@ public class MarkedPlayerConfig { @ConfigOption(name = "Mark Own Name", desc = "Mark own player name.") @ConfigEditorBoolean() public Property<Boolean> markOwnName = Property.of(false); + + @ConfigOption(name = "Marked Chat Color", desc = "Marked Chat Color. §eIf Chroma is gray, enable Chroma in Chroma settings") + @Expose + @ConfigEditorDropdown + public Property<LorenzColor> chatColor = Property.of(LorenzColor.YELLOW); + } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt index 8448627f5..43db53499 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt @@ -41,7 +41,9 @@ class PlayerDeathMessages { !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight && MarkedPlayerManager.isMarkedPlayer(name) ) { val reason = group("reason").removeColor() - LorenzUtils.chat(" §c☠ §e$name §7$reason", false) + + val color = SkyHanniMod.feature.markedPlayers.chatColor.get().getChatColor() + LorenzUtils.chat(" §c☠ $color$name §7$reason", false) event.blockedReason = "marked_player_death" return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt index 60ed955a3..7b52f6c60 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt @@ -79,11 +79,13 @@ class PlayerChatModifier { } if (SkyHanniMod.feature.markedPlayers.highlightInChat) { + val color = SkyHanniMod.feature.markedPlayers.chatColor.get().getChatColor() for (markedPlayer in MarkedPlayerManager.playerNamesToMark) { - string = string.replace(markedPlayer, "§e$markedPlayer§r") + string = string.replace(markedPlayer, "$color$markedPlayer§r") } } + return string } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt index fe3c3bc94..e8b0d76bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt @@ -4,23 +4,24 @@ import at.hannibal2.skyhanni.test.command.ErrorManager import net.minecraft.item.EnumDyeColor import java.awt.Color -enum class LorenzColor(private var chatColorCode: Char, private val color: Color) { - BLACK('0', Color(0, 0, 0)), - DARK_BLUE('1', Color(0, 0, 170)), - DARK_GREEN('2', Color(0, 170, 0)), - DARK_AQUA('3', Color(0, 170, 170)), - DARK_RED('4', Color(170, 0, 0)), - DARK_PURPLE('5', Color(170, 0, 170)), - GOLD('6', Color(255, 170, 0)), - GRAY('7', Color(170, 170, 170)), - DARK_GRAY('8', Color(85, 85, 85)), - BLUE('9', Color(85, 85, 255)), - GREEN('a', Color(85, 255, 85)), - AQUA('b', Color(85, 255, 255)), - RED('c', Color(255, 85, 85)), - LIGHT_PURPLE('d', Color(255, 85, 255)), - YELLOW('e', Color(255, 255, 85)), - WHITE('f', Color(255, 255, 255)), +enum class LorenzColor(private val chatColorCode: Char, private val color: Color, private val coloredLabel: String) { + BLACK('0', Color(0, 0, 0), "§0Black"), + DARK_BLUE('1', Color(0, 0, 170), "§1Dark Blue"), + DARK_GREEN('2', Color(0, 170, 0), "§2Dark Green"), + DARK_AQUA('3', Color(0, 170, 170), "§3Dark Aqua"), + DARK_RED('4', Color(170, 0, 0), "§4Dark Red"), + DARK_PURPLE('5', Color(170, 0, 170), "§5Dark Purple"), + GOLD('6', Color(255, 170, 0), "§6Gold"), + GRAY('7', Color(170, 170, 170), "§7Gray"), + DARK_GRAY('8', Color(85, 85, 85), "§8Dark Gray"), + BLUE('9', Color(85, 85, 255), "§9Blue"), + GREEN('a', Color(85, 255, 85), "§aGreen"), + AQUA('b', Color(85, 255, 255), "§bAqua"), + RED('c', Color(255, 85, 85), "§cRed"), + LIGHT_PURPLE('d', Color(255, 85, 255), "§dLight Purple"), + YELLOW('e', Color(255, 255, 85), "§eYellow"), + WHITE('f', Color(255, 255, 255), "§fWhite"), + CHROMA('Z', Color(0, 0, 0, 0), "§ZChroma") // If chroma, go transparent instead of color code. ; fun getChatColor(): String = "§$chatColorCode" @@ -35,6 +36,8 @@ enum class LorenzColor(private var chatColorCode: Char, private val color: Color return Color(red, green, blue, opacity) } + override fun toString(): String = coloredLabel + companion object { fun EnumDyeColor.toLorenzColor() = when (this) { EnumDyeColor.WHITE -> WHITE @@ -57,4 +60,4 @@ enum class LorenzColor(private var chatColorCode: Char, private val color: Color } } } -}
\ No newline at end of file +} |