mirror of https://github.com/kami-blue/client
[fix] Bug with ChatTimeStamp and added separator options
Signed-off-by: Dominika <sokolov.dominika@gmail.com>
This commit is contained in:
parent
cbaee402d7
commit
ebd4b9cd1b
|
@ -7,6 +7,7 @@ import me.zeroeightsix.kami.util.color.EnumTextColor
|
|||
import me.zeroeightsix.kami.util.text.format
|
||||
import net.minecraft.util.text.TextComponentString
|
||||
import net.minecraftforge.client.event.ClientChatReceivedEvent
|
||||
import org.kamiblue.commons.interfaces.DisplayEnum
|
||||
import org.kamiblue.event.listener.listener
|
||||
|
||||
object ChatTimestamp : Module(
|
||||
|
@ -15,9 +16,10 @@ object ChatTimestamp : Module(
|
|||
description = "Shows the time a message was sent beside the message",
|
||||
showOnArray = false
|
||||
) {
|
||||
private val color = setting("Color", EnumTextColor.GRAY)
|
||||
private val timeFormat = setting("TimeFormat", TimeUtils.TimeFormat.HHMM)
|
||||
private val timeUnit = setting("TimeUnit", TimeUtils.TimeUnit.H12)
|
||||
private val color by setting("Color", EnumTextColor.GRAY)
|
||||
private val separator by setting("Separator", Separator.ARROWS)
|
||||
private val timeFormat by setting("TimeFormat", TimeUtils.TimeFormat.HHMM)
|
||||
private val timeUnit by setting("TimeUnit", TimeUtils.TimeUnit.H12)
|
||||
|
||||
init {
|
||||
listener<ClientChatReceivedEvent> {
|
||||
|
@ -27,5 +29,14 @@ object ChatTimestamp : Module(
|
|||
}
|
||||
|
||||
val formattedTime: String
|
||||
get() = "<${color.value format TimeUtils.getTime(timeFormat.value, timeUnit.value)}>"
|
||||
get() = "${separator.left}${color format TimeUtils.getTime(timeFormat, timeUnit)}${separator.right} "
|
||||
|
||||
@Suppress("unused")
|
||||
private enum class Separator(override val displayName: String, val left: String, val right: String) : DisplayEnum {
|
||||
ARROWS("< >", "<", ">"),
|
||||
SQUARE_BRACKETS("[ ]", "[", "]"),
|
||||
CURLY_BRACKETS("{ }", "{", "}"),
|
||||
ROUND_BRACKETS("( )", "(", ")"),
|
||||
NONE("None", "", "")
|
||||
}
|
||||
}
|
|
@ -19,5 +19,7 @@ enum class EnumTextColor(val textFormatting: TextFormatting) {
|
|||
RED(TextFormatting.RED),
|
||||
LIGHT_PURPLE(TextFormatting.LIGHT_PURPLE),
|
||||
YELLOW(TextFormatting.YELLOW),
|
||||
WHITE(TextFormatting.WHITE)
|
||||
WHITE(TextFormatting.WHITE);
|
||||
|
||||
override fun toString(): String = this.textFormatting.toString()
|
||||
}
|
Loading…
Reference in New Issue