From 416a767ac27c4ebf9d60c933037b7f94623e7ecf Mon Sep 17 00:00:00 2001 From: minhperry <46137516+minhperry@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:49:47 +0200 Subject: Feature: Colors and formatting helper in chat (#2216) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../hannibal2/skyhanni/config/commands/Commands.kt | 7 ++- .../features/chat/ColorFormattingHelper.kt | 60 ++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/chat/ColorFormattingHelper.kt diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index a1549aacf..a8b3deb6b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.data.TitleManager import at.hannibal2.skyhanni.data.bazaar.HypixelBazaarFetcher import at.hannibal2.skyhanni.features.bingo.card.BingoCardDisplay import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.BingoNextStepHelper +import at.hannibal2.skyhanni.features.chat.ColorFormattingHelper import at.hannibal2.skyhanni.features.chat.translation.Translator import at.hannibal2.skyhanni.features.combat.endernodetracker.EnderNodeTracker import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil @@ -347,8 +348,12 @@ object Commands { ) { PestFinder.teleportNearestInfestedPlot() } registerCommand( "shhoppitystats", - "Look up stats for a Hoppity's Event (by SkyBlock year).\nRun standalone for a list of years that have stats." + "Look up stats for a Hoppity's Event (by SkyBlock year).\nRun standalone for a list of years that have stats.", ) { HoppityEventSummary.sendStatsMessage(it) } + registerCommand( + "shcolors", + "Prints a list of all Minecraft color & formatting codes in chat.", + ) { ColorFormattingHelper.printColorCodeList() } } private fun usersBugFix() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ColorFormattingHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ColorFormattingHelper.kt new file mode 100644 index 000000000..9c7c03806 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ColorFormattingHelper.kt @@ -0,0 +1,60 @@ +package at.hannibal2.skyhanni.features.chat + +import at.hannibal2.skyhanni.utils.ChatUtils +import net.minecraft.util.ChatComponentText + +object ColorFormattingHelper { + fun printColorCodeList() { + ChatUtils.chat( + ChatComponentText( + "§c=================== General Colors ===================\n" + + "§f&0 = §0Black §f&1 = §1Dark Blue\n" + + "§f&2 = §2Dark Green §f&3 = §3Dark Aqua\n" + + "§f&4 = §4Dark Red §f&5 = §5Dark Purple\n" + + "§f&6 = §6Gold §f&7 = §7Gray\n" + + "§f&8 = §8Dark Gray §f&9 = §9Blue\n" + + "§f&a = §aGreen §f&b = §bAqua\n" + + "§f&c = §cRed §f&d = §dLight Purple\n" + + "§f&e = §eYellow §f&f = §fWhite\n" + + "§f&Z = §zChroma §r(needs to enable chroma setting)\n" + + "§c================= Formatting Codes ==================\n" + + "§f&k = Obfuscated (like this: §khellspawn§r)\n" + + "§f&l = §lBold §r&m = §mStrikethrough \n" + + "§f&o = §oItalic §r&n = §nUnderline\n" + + "§f&r = Reset\n"+ + "§c===================================================" + ) + ) + ChatUtils.clickableChat( + "§eClick to view extra info about colors and formatting.", + onClick = { printColorCodesExtra() }, + "§eClick to see more!", + prefix = false, + ) + } + + private fun printColorCodesExtra() { + ChatUtils.chat("§c================= Formatting Extra ==================", false) + ChatUtils.clickableLinkChat( + "§#§6§a§e§e§4§8§/[Click here to view codes on minecraft.wiki]", + "https://minecraft.wiki/w/Formatting_codes#Color_codes", + "§eOpen §cminecraft.wiki§e!", + false, + false, + ) + ChatUtils.chat( + "§eYou can also uses SkyHanni's system for any colors. " + + "This is different from chroma. " + + "Simply type §6&#&f&f&9&a&2&e&/ §efor color §#§f§f§9§a§2§e§/#ff9a2e§e " + + "(adds §6& §ebefore every characters including §6#§e, ends with '§6&/§e').", + false, + ) + ChatUtils.clickableLinkChat( + "§z[Click here to open color picker color-hex.com]", + url = "https://www.color-hex.com", + "§eOpen §ccolor-hex.com§e!", + prefix = false, + ) + ChatUtils.chat("§c===================================================", false) + } +} -- cgit