diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-04-07 18:39:07 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-07 10:39:07 +0200 |
commit | 0850dc6a0195d7e52cea13cc5838e75d216f81b7 (patch) | |
tree | e59d05b9fff66dd3d50ff75d497cbc8448d2fdd2 /src/main/java/at/hannibal2/skyhanni/config | |
parent | 31bfd8a1d3437f4bdbefa7bcba75143e37c4ac90 (diff) | |
download | skyhanni-0850dc6a0195d7e52cea13cc5838e75d216f81b7.tar.gz skyhanni-0850dc6a0195d7e52cea13cc5838e75d216f81b7.tar.bz2 skyhanni-0850dc6a0195d7e52cea13cc5838e75d216f81b7.zip |
Backend: Change stuff around with chat messages (#1227)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/config')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt | 26 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index 4059761c3..3a38db02a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -236,7 +236,7 @@ class ConfigManager { val jsonObject = gson.fromJson(bufferedReader.readText(), JsonObject::class.java) val newJsonObject = ConfigUpdaterMigrator.fixConfig(jsonObject) val run = { gson.fromJson(newJsonObject, defaultValue.javaClass) } - if (LorenzUtils.isInDevEnviromen()) { + if (LorenzUtils.isInDevEnvironment()) { try { run() } catch (e: Throwable) { 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 1b8c2bdeb..1e1cc0da3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -80,10 +80,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.repopatterns.RepoPatternGui -import net.minecraft.client.Minecraft import net.minecraft.command.ICommandSender -import net.minecraft.event.ClickEvent -import net.minecraft.event.HoverEvent import net.minecraft.util.BlockPos import net.minecraft.util.ChatComponentText import net.minecraftforge.client.ClientCommandHandler @@ -522,30 +519,33 @@ object Commands { } else { title = "All SkyHanni commands" } - val base = ChatComponentText(" \n§7$title:\n") + + val components = mutableListOf<ChatComponentText>() + components.add(ChatComponentText(" \n§7$title:\n")) + for (command in commands) { if (!filter(command.name) && !filter(command.description)) continue val category = command.category val name = command.name val color = category.color - val text = ChatComponentText("$color/$name") - text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/$name") val hoverText = buildList { add("§e/$name") - add(" §7${command.description}") + if (command.description.isNotEmpty()) { + add(" §7${command.description}") + } add("") add("$color${category.categoryName}") add(" §7${category.description}") } - text.chatStyle.chatHoverEvent = - HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText(hoverText.joinToString("\n"))) - base.appendSibling(text) - base.appendSibling(ChatComponentText("§7, ")) + val commandInfo = ChatUtils.createHoverableChat("$color/$name", hoverText, "/$name", false) + + components.add(commandInfo) + components.add(ChatComponentText("§7, ")) } - base.appendSibling(ChatComponentText("\n ")) - Minecraft.getMinecraft().thePlayer.addChatMessage(base) + components.add(ChatComponentText("\n ")) + ChatUtils.multiComponentMessage(components) } @JvmStatic |