From a5753a95f4726005a8ad854f684f07e483037ade Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 18 Jan 2024 20:42:27 +0100 Subject: adding repo status to /shdebug --- .../at/hannibal2/skyhanni/data/repo/RepoManager.kt | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/data') diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index 9dcba5e8f..8c12444ac 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -2,11 +2,13 @@ package at.hannibal2.skyhanni.data.repo import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager +import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.LorenzUtils import com.google.gson.JsonObject import net.minecraft.client.Minecraft +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.apache.commons.io.FileUtils import java.io.BufferedReader import java.io.BufferedWriter @@ -172,6 +174,27 @@ class RepoManager(private val configLocation: File) { return comp } + @SubscribeEvent + fun onDebugDataCollect(event: DebugDataCollectEvent) { + event.title("Repo Status") + + if (unsuccessfulConstants.isEmpty() && successfulConstants.isNotEmpty()) { + event.ignore("Repo working fine") + return + } + + event.addData { + if (successfulConstants.isNotEmpty()) add("Successful Constants (${successfulConstants.size}):") + for (constant in successfulConstants) { + add(" - $constant") + } + add("Unsuccessful Constants (${unsuccessfulConstants.size}):") + for (constant in unsuccessfulConstants) { + add(" - $constant") + } + } + } + fun displayRepoStatus(joinEvent: Boolean) { if (joinEvent) { if (unsuccessfulConstants.isNotEmpty()) { -- cgit