aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/test/command/CopyBossbarCommand.kt
blob: 3b29821fd006a7ecd4910fee82bcb147f82a07cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package at.hannibal2.skyhanni.test.command

import at.hannibal2.skyhanni.data.BossbarData
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.StringUtils.removeColor

object CopyBossbarCommand {
    fun command(args: Array<String>) {
        val noFormattingCodes = args.size == 1 && args[0] == "true"
        val bossbarName = if (noFormattingCodes) BossbarData.getBossbar().removeColor() else BossbarData.getBossbar()
        val status = if (noFormattingCodes) "without" else "with"
        if (bossbarName.isBlank()) {
            ChatUtils.chat("Boss bar appears to be blank.")
        } else {
            OSUtils.copyToClipboard(bossbarName)
            ChatUtils.chat("Boss bar name copied to clipboard $status formatting codes!")
        }
    }
}