From 4b44988d83f1522c8279d9571e7b438d8f17cac0 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 18 Jan 2024 20:22:08 +0100 Subject: moving debug command into own class --- .../hannibal2/skyhanni/config/commands/Commands.kt | 3 +- .../at/hannibal2/skyhanni/test/DebugCommand.kt | 122 +++++++++++++++++++++ .../skyhanni/test/SkyHanniDebugsAndTests.kt | 113 ------------------- 3 files changed, 124 insertions(+), 114 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt (limited to 'src') 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 2f70c7e55..bb05b8aee 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -48,6 +48,7 @@ import at.hannibal2.skyhanni.features.misc.massconfiguration.DefaultConfigFeatur import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui import at.hannibal2.skyhanni.features.rift.area.westvillage.VerminTracker import at.hannibal2.skyhanni.features.slayer.SlayerProfitTracker +import at.hannibal2.skyhanni.test.DebugCommand import at.hannibal2.skyhanni.test.PacketTest import at.hannibal2.skyhanni.test.SkyHanniConfigSearchResetCommand import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests @@ -264,7 +265,7 @@ object Commands { registerCommand( "shdebug", "Copies SkyHanni debug data in the clipboard." - ) { SkyHanniDebugsAndTests.debugData(it) } + ) { DebugCommand.command(it) } registerCommand( "shversion", "Prints the SkyHanni version in the chat" diff --git a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt new file mode 100644 index 000000000..a89a3bb05 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt @@ -0,0 +1,122 @@ +package at.hannibal2.skyhanni.test + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.DebugDataCollectEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.OSUtils +import at.hannibal2.skyhanni.utils.StringUtils.equalsIgnoreColor + +object DebugCommand { + + fun command(args: Array) { + if (args.size == 2 && args[0] == "profileName") { + HypixelData.profileName = args[1].lowercase() + LorenzUtils.chat("§eManually set profileName to '${HypixelData.profileName}'") + return + } + val list = mutableListOf() + list.add("```") + list.add("= Debug Information for SkyHanni ${SkyHanniMod.version} =") + list.add("") + + val search = args.getOrNull(0) + list.add( + if (search != null) { + if (search.equalsIgnoreColor("all")) { + "search for everything." + } else "search: '$search'" + } else "search not specified, showing only interesting stuff" + ) + + val event = DebugDataCollectEvent(list, search) + + event.title("Player") + event.ignore { + add("name: '${LorenzUtils.getPlayerName()}'") + add("uuid: '${LorenzUtils.getPlayerUuid()}'") + } + + event.title("Repo Auto Update") + if (SkyHanniMod.feature.dev.repoAutoUpdate) { + event.ignore("normal enabled") + } else { + event.addData("The repo does not auto update because auto update is disabled!") + } + + event.title("Global Render") + if (SkyHanniDebugsAndTests.globalRender) { + event.ignore("normal enabled") + } else { + event.addData { + add("Global renderer is disabled!") + add("No renderable elements from SkyHanni will show up anywhere!") + } + } + + event.title("SkyBlock Status") + if (!LorenzUtils.onHypixel) { + event.addData("not on Hypixel") + } else { + if (!LorenzUtils.inSkyBlock) { + event.addData("not on SkyBlock, but on Hypixel") + } else { + if (LorenzUtils.skyBlockIsland == IslandType.UNKNOWN) { + event.addData("Unknown SkyBlock island!") + } else { + event.ignore { + add("on Hypixel SkyBlock") + add("skyBlockIsland: ${LorenzUtils.skyBlockIsland}") + add("skyBlockArea: '${LorenzUtils.skyBlockArea}'") + } + } + } + } + + event.title("Profile Name") + if (!LorenzUtils.inSkyBlock) { + event.ignore("Not on SkyBlcok") + } else { + if (HypixelData.profileName != "") { + event.ignore("profileName: '${HypixelData.profileName}'") + } else { + event.addData("profile name is empty!") + } + } + + + event.title("Profile Type") + if (!LorenzUtils.inSkyBlock) { + event.ignore("Not on SkyBlcok") + } else { + val classic = !LorenzUtils.noTradeMode + if (classic) { + event.ignore("on classic") + } else { + if (HypixelData.ironman) { + event.addData("on ironman") + } + if (HypixelData.stranded) { + event.addData("on stranded") + } + if (HypixelData.bingo) { + event.addData("on bingo") + } + } + } + + event.postAndCatch() + + if (event.empty) { + list.add("") + list.add("Nothing interesting to show right now!") + list.add("Looking for something specific? /shdebug ") + list.add("Wanna see everything? /shdebug all") + } + + list.add("```") + OSUtils.copyToClipboard(list.joinToString("\n")) + LorenzUtils.chat("§eCopied SkyHanni debug data in the clipboard.") + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 091ddf499..ec850f5dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -7,8 +7,6 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.HypixelData -import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -41,7 +39,6 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils -import at.hannibal2.skyhanni.utils.StringUtils.equalsIgnoreColor import kotlinx.coroutines.launch import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiContainer @@ -344,116 +341,6 @@ class SkyHanniDebugsAndTests { OSUtils.copyToClipboard(name) } - fun debugData(args: Array) { - if (args.size == 2 && args[0] == "profileName") { - HypixelData.profileName = args[1].lowercase() - LorenzUtils.chat("§eManually set profileName to '${HypixelData.profileName}'") - return - } - val list = mutableListOf() - list.add("```") - list.add("= Debug Information for SkyHanni ${SkyHanniMod.version} =") - list.add("") - - val search = args.getOrNull(0) - list.add( - if (search != null) { - if (search.equalsIgnoreColor("all")) { - "search for everything." - } else "search: '$search'" - } else "search not specified, showing only interesting stuff" - ) - - val event = DebugDataCollectEvent(list, search) - - event.title("Player") - event.ignore { - add("name: '${LorenzUtils.getPlayerName()}'") - add("uuid: '${LorenzUtils.getPlayerUuid()}'") - } - - event.title("Repo Auto Update") - if (config.repoAutoUpdate) { - event.ignore("normally enabled") - } else { - event.addData("The repo does not auto update because auto update is disabled!") - } - - event.title("Global Render") - if (globalRender) { - event.ignore("normally enabled") - } else { - event.addData { - add("Global renderer is disabled!") - add("No renderable elements from SkyHanni will show up anywhere!") - } - } - - event.title("SkyBlock Status") - if (!LorenzUtils.onHypixel) { - event.addData("not on Hypixel") - } else { - if (!LorenzUtils.inSkyBlock) { - event.addData("not on SkyBlock, but on Hypixel") - } else { - if (LorenzUtils.skyBlockIsland == IslandType.UNKNOWN) { - event.addData("Unknown SkyBlock island!") - } else { - event.ignore { - add("on Hypixel SkyBlock") - add("skyBlockIsland: ${LorenzUtils.skyBlockIsland}") - add("skyBlockArea: '${LorenzUtils.skyBlockArea}'") - } - } - } - } - - event.title("Profile Name") - if (!LorenzUtils.inSkyBlock) { - event.ignore("Not on SkyBlcok") - } else { - if (HypixelData.profileName != "") { - event.ignore("profileName: '${HypixelData.profileName}'") - } else { - event.addData("profile name is empty!") - } - } - - - event.title("Profile Type") - if (!LorenzUtils.inSkyBlock) { - event.ignore("Not on SkyBlcok") - } else { - val classic = !LorenzUtils.noTradeMode - if (classic) { - event.ignore("on classic") - } else { - if (HypixelData.ironman) { - event.addData("on ironman") - } - if (HypixelData.stranded) { - event.addData("on stranded") - } - if (HypixelData.bingo) { - event.addData("on bingo") - } - } - } - - event.postAndCatch() - - if (event.empty) { - list.add("") - list.add("Nothing interesting to show right now!") - list.add("Looking for something specific? /shdebug ") - list.add("Wanna see everything? /shdebug all") - } - - list.add("```") - OSUtils.copyToClipboard(list.joinToString("\n")) - LorenzUtils.chat("§eCopied SkyHanni debug data in the clipboard.") - } - fun copyItemInternalName() { val hand = InventoryUtils.getItemInHand() if (hand == null) { -- cgit