[feature] Added color option to TabFriends

Closes #1559

Signed-off-by: Dominika <sokolov.dominika@gmail.com>
This commit is contained in:
Dominika 2021-01-04 23:37:52 -05:00
parent b9553fcce4
commit 978364f111
No known key found for this signature in database
GPG Key ID: B4A5A6DCA70F861F
1 changed files with 12 additions and 4 deletions

View File

@ -2,9 +2,11 @@ package me.zeroeightsix.kami.module.modules.render
import me.zeroeightsix.kami.manager.managers.FriendManager
import me.zeroeightsix.kami.module.Module
import me.zeroeightsix.kami.setting.ModuleConfig.setting
import me.zeroeightsix.kami.util.color.EnumTextColor
import me.zeroeightsix.kami.util.text.format
import net.minecraft.client.network.NetworkPlayerInfo
import net.minecraft.scoreboard.ScorePlayerTeam
import net.minecraft.util.text.TextFormatting
@Module.Info(
name = "TabFriends",
@ -13,10 +15,16 @@ import net.minecraft.util.text.TextFormatting
showOnArray = false
)
object TabFriends : Module() {
private val color = setting("Color", EnumTextColor.GREEN)
@JvmStatic
fun getPlayerName(info: NetworkPlayerInfo): String {
val name = info.displayName?.formattedText
?: ScorePlayerTeam.formatPlayerName(info.playerTeam, info.gameProfile.name)
return if (FriendManager.isFriend(name)) "${TextFormatting.GREEN}$name" else name
val name = info.displayName?.formattedText ?: ScorePlayerTeam.formatPlayerName(info.playerTeam, info.gameProfile.name)
return if (FriendManager.isFriend(name)) {
color.value format name
} else {
name
}
}
}