aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-05-07 04:57:12 +1000
committerGitHub <noreply@github.com>2023-05-06 20:57:12 +0200
commit92352ba052c1c3e403ef41493cbf57f8be63639b (patch)
tree05e63ff23bc750a73d3f570df652ec5e489ecedb /src
parenta2415221255e9e5bd0f12a4876117064c3ded3e5 (diff)
downloadskyhanni-92352ba052c1c3e403ef41493cbf57f8be63639b.tar.gz
skyhanni-92352ba052c1c3e403ef41493cbf57f8be63639b.tar.bz2
skyhanni-92352ba052c1c3e403ef41493cbf57f8be63639b.zip
Added a few commands for debugging and testing (#93)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt (renamed from src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt)2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt20
8 files changed, 89 insertions, 17 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 00bd0a802..081e6a5b0 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -66,8 +66,8 @@ import at.hannibal2.skyhanni.features.slayer.blaze.HellionShieldHelper
import at.hannibal2.skyhanni.features.summonings.SummoningMobManager
import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
-import at.hannibal2.skyhanni.test.LorenzTest
import at.hannibal2.skyhanni.test.PacketTest
+import at.hannibal2.skyhanni.test.SkyHanniTestCommand
import at.hannibal2.skyhanni.test.TestBingo
import at.hannibal2.skyhanni.utils.MinecraftConsoleFilter.Companion.initLogging
import at.hannibal2.skyhanni.utils.NEUVersionCheck.checkIfNeuIsLoaded
@@ -270,7 +270,7 @@ class SkyHanniMod {
init()
- loadModule(LorenzTest())
+ loadModule(SkyHanniTestCommand())
loadModule(ButtonOnPause())
loadModule(PacketTest())
loadModule(TestBingo)
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 0981fdaa4..2ecdb2d98 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -15,11 +15,10 @@ import at.hannibal2.skyhanni.features.garden.farming.CropSpeedMeter
import at.hannibal2.skyhanni.features.minion.MinionFeatures
import at.hannibal2.skyhanni.features.misc.CollectionCounter
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
-import at.hannibal2.skyhanni.test.LorenzTest
import at.hannibal2.skyhanni.test.PacketTest
+import at.hannibal2.skyhanni.test.SkyHanniTestCommand
import at.hannibal2.skyhanni.test.TestBingo
-import at.hannibal2.skyhanni.test.command.CopyItemCommand
-import at.hannibal2.skyhanni.test.command.CopyNearbyEntitiesCommand
+import at.hannibal2.skyhanni.test.command.*
import at.hannibal2.skyhanni.utils.APIUtil
import net.minecraft.command.ICommandSender
import net.minecraftforge.client.ClientCommandHandler
@@ -43,21 +42,23 @@ object Commands {
registerCommand("skyhanni", openMainMenu)
registerCommand("shreloadlocalrepo") { SkyHanniMod.repo.reloadLocalRepo() }
registerCommand("shupdaterepo") { SkyHanniMod.repo.updateRepo() }
- registerCommand("testhanni") { LorenzTest.testCommand(it) }
- registerCommand("copylocation") { LorenzTest.copyLocation() }
- registerCommand("copyentities") { CopyNearbyEntitiesCommand.command(it) }
- registerCommand("copyitem") { CopyItemCommand.command(it) }
+ registerCommand("shtest") { SkyHanniTestCommand.testCommand(it) }
+ registerCommand("shcopylocation") { SkyHanniTestCommand.copyLocation() }
+ registerCommand("shcopyentities") { CopyNearbyEntitiesCommand.command(it) }
+ registerCommand("shcopytablist") { CopyTabListCommand.command(it) }
+ registerCommand("shcopyscoreboard") { CopyScoreboardCommand.command(it) }
+ registerCommand("shcopyitem") { CopyItemCommand.command(it) }
registerCommand("shconfigsave") { SkyHanniMod.configManager.saveConfig("manual-command") }
registerCommand("shmarkplayer") { MarkedPlayerManager.command(it) }
registerCommand("shtestpacket") { PacketTest.toggle() }
- registerCommand("shreloadlisteners") { LorenzTest.reloadListeners() }
- registerCommand("shstoplisteners") { LorenzTest.stopListeners() }
+ registerCommand("shreloadlisteners") { SkyHanniTestCommand.reloadListeners() }
+ registerCommand("shstoplisteners") { SkyHanniTestCommand.stopListeners() }
registerCommand("shresetburrowwarps") { BurrowWarpHelper.resetDisabledWarps() }
registerCommand("shtrackcollection") { CollectionCounter.command(it) }
registerCommand("shreloadbingodata") { BingoCardDisplay.command() }
registerCommand("shprintbingohelper") { BingoNextStepHelper.command() }
registerCommand("shsetapikey") { ApiDataLoader.command(it) }
- registerCommand("shtestgardenvisitors") { LorenzTest.testGardenVisitors() }
+ registerCommand("shtestgardenvisitors") { SkyHanniTestCommand.testGardenVisitors() }
registerCommand("shtogglehypixelapierrors") { APIUtil.toggleApiErrorMessages() }
registerCommand("shcropspeedmeter") { CropSpeedMeter.toggle() }
registerCommand("shcroptime") { GardenCropTimeCommand.onCommand(it) }
@@ -65,6 +66,7 @@ object Commands {
registerCommand("shclearcropspeed") { GardenAPI.clearCropSpeed() }
registerCommand("shclearminiondata") { MinionFeatures.clearMinionData() }
registerCommand("shtestbingo") { TestBingo.toggle() }
+ registerCommand("shtestmessage") { TestChatCommand.command(it) }
}
private fun registerCommand(name: String, function: (Array<String>) -> Unit) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
index af6cfa997..93886069c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.features.dungeon.DungeonData
import at.hannibal2.skyhanni.features.slayer.blaze.HellionShield
import at.hannibal2.skyhanni.features.slayer.blaze.setHellionShield
-import at.hannibal2.skyhanni.test.LorenzTest
+import at.hannibal2.skyhanni.test.SkyHanniTestCommand
import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith
import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith
@@ -668,7 +668,7 @@ class DamageIndicatorManager {
270_000 / 2, 270_000 -> 1
1 -> 0
else -> {
- LorenzTest.displayLine = "thorn has ${LorenzUtils.formatDouble(realHealth.toDouble())} hp!"
+ SkyHanniTestCommand.displayLine = "thorn has ${LorenzUtils.formatDouble(realHealth.toDouble())} hp!"
LorenzUtils.error(
"Unexpected health of thorn in m4! (${
LorenzUtils.formatDouble(
diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt
index 8abe8e474..a320123a1 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt
@@ -16,7 +16,7 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.io.File
-class LorenzTest {
+class SkyHanniTestCommand {
companion object {
var displayLine = ""
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
index 92275ed69..10865a213 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
@@ -1,6 +1,6 @@
package at.hannibal2.skyhanni.test.command
-import at.hannibal2.skyhanni.test.LorenzTest
+import at.hannibal2.skyhanni.test.SkyHanniTestCommand
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -32,7 +32,7 @@ object CopyItemCommand {
resultList.add("")
resultList.add("ExtraAttributes")
val extraAttributes = tagCompound.getCompoundTag("ExtraAttributes")
- LorenzTest.runn(extraAttributes, " . ")
+ SkyHanniTestCommand.runn(extraAttributes, " . ")
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt
new file mode 100644
index 000000000..b53b2af19
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt
@@ -0,0 +1,25 @@
+package at.hannibal2.skyhanni.test.command
+
+import at.hannibal2.skyhanni.data.ScoreboardData
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.OSUtils
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+
+object CopyScoreboardCommand {
+ fun command(args: Array<String>) {
+ try {
+ val resultList = mutableListOf<String>()
+ val noColor = args.size == 1 && args[0] == "true"
+ for (line in ScoreboardData.sidebarLinesFormatted) {
+ val scoreboardLine = if (noColor) line.removeColor() else line
+ resultList.add("'$scoreboardLine'")
+ }
+ val string = resultList.joinToString("\n")
+ OSUtils.copyToClipboard(string)
+ LorenzUtils.chat("§e[SkyHanni] scoreboard copied into the clipboard!")
+ }
+ catch (_: Throwable) {
+ LorenzUtils.chat("§c[SkyHanni] Nothing in scoreboard")
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt
new file mode 100644
index 000000000..65ec85d37
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyTabListCommand.kt
@@ -0,0 +1,25 @@
+package at.hannibal2.skyhanni.test.command
+
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.OSUtils
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.TabListData
+
+object CopyTabListCommand {
+ fun command(args: Array<String>) {
+ try {
+ val resultList = mutableListOf<String>()
+ val noColor = args.size == 1 && args[0] == "true"
+ for (line in TabListData.getTabList()) {
+ val tabListLine = if (noColor) line.removeColor() else line
+ resultList.add("'$tabListLine'")
+ }
+ val string = resultList.joinToString("\n")
+ OSUtils.copyToClipboard(string)
+ LorenzUtils.chat("§e[SkyHanni] tablist copied into the clipboard!")
+ }
+ catch (_: Throwable) {
+ LorenzUtils.chat("§c[SkyHanni] Nothing in tablist")
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt
new file mode 100644
index 000000000..39740a8ec
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.test.command
+
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.util.ChatComponentText
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.common.MinecraftForge
+
+object TestChatCommand {
+ fun command(args: Array<String>) {
+ if (args.isEmpty()) {
+ LorenzUtils.chat("§c[SkyHanni] Specify a chat message to test")
+ return
+ }
+ val rawMessage = args.toList().joinToString(" ")
+ LorenzUtils.chat("§a[SkyHanni] testing message: §7$rawMessage")
+ val formattedMessage = rawMessage.replace("&", "§")
+ LorenzUtils.chat(formattedMessage)
+ MinecraftForge.EVENT_BUS.post(ClientChatReceivedEvent(0, ChatComponentText(formattedMessage)))
+ }
+} \ No newline at end of file