diff --git a/src/main/kotlin/me/santio/minehututils/commands/CooldownCommand.kt b/src/main/kotlin/me/santio/minehututils/commands/CooldownCommand.kt index c4a5ce4..6a6f994 100644 --- a/src/main/kotlin/me/santio/minehututils/commands/CooldownCommand.kt +++ b/src/main/kotlin/me/santio/minehututils/commands/CooldownCommand.kt @@ -32,12 +32,14 @@ class CooldownCommand { } val cooldowns = CooldownRegistry.cooldowns[e.user.id] ?: emptySet() + val defaultCooldowns = Cooldown.Kind.entries.distinctBy { it.channel } + var body = """ | :clipboard: Channel Cooldowns | | **Server Cooldowns** - ${Cooldown.Kind.entries.joinToString("\n") { - val name = it.display + ${defaultCooldowns.joinToString("\n") { + val name = it.channel.display val duration = DurationResolver.pretty(it.getDuration()) "| $name: $duration" diff --git a/src/main/kotlin/me/santio/minehututils/cooldown/Cooldown.kt b/src/main/kotlin/me/santio/minehututils/cooldown/Cooldown.kt index b7bc062..865277e 100644 --- a/src/main/kotlin/me/santio/minehututils/cooldown/Cooldown.kt +++ b/src/main/kotlin/me/santio/minehututils/cooldown/Cooldown.kt @@ -1,5 +1,6 @@ package me.santio.minehututils.cooldown +import me.santio.minehututils.data.Channel import me.santio.minehututils.resolvers.DurationResolver import me.santio.minehututils.resolvers.DurationResolver.pretty import me.santio.minehututils.utils.EnvUtils.env @@ -41,11 +42,11 @@ data class Cooldown( return pretty(Duration.ofSeconds(remaining)) } - enum class Kind(val display: String, private val envVariable: String) { - ADVERTISEMENT_SERVER("Advertisement (Server)", "ADVERT_COOLDOWN"), - ADVERTISEMENT_USER("Advertisement (User)", "ADVERT_COOLDOWN"), - MARKET_OFFER("Marketplace (Offer)", "MARKET_COOLDOWN"), - MARKET_REQUEST("Marketplace (Request)", "MARKET_COOLDOWN"), + enum class Kind(val display: String, val channel: Channel, private val envVariable: String) { + ADVERTISEMENT_SERVER("Advertisement (Server)", Channel.ADVERTISEMENTS, "ADVERT_COOLDOWN"), + ADVERTISEMENT_USER("Advertisement (User)", Channel.ADVERTISEMENTS, "ADVERT_COOLDOWN"), + MARKET_OFFER("Marketplace (Offer)", Channel.MARKETPLACE, "MARKET_COOLDOWN"), + MARKET_REQUEST("Marketplace (Request)", Channel.MARKETPLACE, "MARKET_COOLDOWN"), ; fun getDuration(): Duration { diff --git a/src/main/kotlin/me/santio/minehututils/data/Channel.kt b/src/main/kotlin/me/santio/minehututils/data/Channel.kt index 410a165..b74b63d 100644 --- a/src/main/kotlin/me/santio/minehututils/data/Channel.kt +++ b/src/main/kotlin/me/santio/minehututils/data/Channel.kt @@ -2,10 +2,10 @@ package me.santio.minehututils.data import me.santio.minehututils.utils.EnvUtils.env -enum class Channel(private val envVariable: String) { +enum class Channel(val display: String, private val envVariable: String) { - ADVERTISEMENTS("ADVERT_CHANNEL"), - MARKETPLACE("MARKET_CHANNEL"), + ADVERTISEMENTS("Advertisements", "ADVERT_CHANNEL"), + MARKETPLACE("Marketplace", "MARKET_CHANNEL"), ; fun get(): String? {