diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2023-10-28 19:57:43 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-28 10:57:43 +0200 |
commit | af965ca7b13f5220d97565ee1829043d659a665f (patch) | |
tree | 64436475a867d61b1e398082b23eaa6eb1c81b5d /src | |
parent | f849c11c4d6fe713ef64d29e4a81c45b219c6c12 (diff) | |
download | NotEnoughUpdates-af965ca7b13f5220d97565ee1829043d659a665f.tar.gz NotEnoughUpdates-af965ca7b13f5220d97565ee1829043d659a665f.tar.bz2 NotEnoughUpdates-af965ca7b13f5220d97565ee1829043d659a665f.zip |
Added logging to repo error popup (#904)
Made the repo error log what file is missing
Diffstat (limited to 'src')
18 files changed, 34 insertions, 29 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index ce2cd340..6722d1f1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -1660,7 +1660,7 @@ public class NEUManager { if (displayName == null) { displayName = internalName; - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification(internalName); if (NotEnoughUpdates.INSTANCE.config.hidden.dev) { Utils.addChatMessage("§c[NEU] Found no display name in repo for '" + internalName + "'!"); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java index 8602ef34..7c10b86e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java @@ -214,14 +214,16 @@ public class ItemTooltipRngListener { dungeonData.clear(); JsonObject leveling = Constants.LEVELING; - if (leveling == null || - !leveling.has("slayer_boss_xp") || + if (leveling == null) { + Utils.showOutdatedRepoNotification("leveling.json"); + return; + } else if (!leveling.has("slayer_boss_xp") || !leveling.has("slayer_highest_tier") || !leveling.has("slayer_tier_colors") || !leveling.has("rng_meter_dungeon_score") || !leveling.has("fancy_name_to_slayer") || !leveling.has("slayer_boss_xp_type")) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("leveling.json (outdated)"); return; } @@ -377,7 +379,7 @@ public class ItemTooltipRngListener { JsonObject jsonObject = Constants.RNGSCORE; if (jsonObject == null) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("rngscore.json"); return -1; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java index 0b4e3934..15f1a954 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java @@ -43,11 +43,9 @@ import io.github.moulberry.notenoughupdates.overlays.TextTabOverlay; import io.github.moulberry.notenoughupdates.recipes.RecipeHistory; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.NotificationHandler; -import io.github.moulberry.notenoughupdates.util.ProfileApiSyncer; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.TabSkillInfoParser; import io.github.moulberry.notenoughupdates.util.Utils; -import io.github.moulberry.notenoughupdates.util.XPInformation; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.event.ClickEvent; @@ -242,7 +240,7 @@ public class NEUEventListener { if (!NotEnoughUpdates.INSTANCE.config.hidden.loadedModBefore) { NotEnoughUpdates.INSTANCE.config.hidden.loadedModBefore = true; if (Constants.MISC == null || !Constants.MISC.has("featureslist")) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("misc.json"); Utils.addChatMessage( "" + EnumChatFormatting.GOLD + "To view the feature list after restarting type /neufeatures"); } else { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index b24af575..f3efa453 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -270,7 +270,7 @@ public class PetInfoOverlay extends TextOverlay { public static Pet getPetFromStack(NBTTagCompound tag) { if (Constants.PETS == null || Constants.PETS.get("pet_levels") == null || Constants.PETS.get("pet_levels") instanceof JsonNull) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("pets.json"); return null; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoLoader.java index 4c3af84e..5bfa2de5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoLoader.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoLoader.java @@ -95,7 +95,7 @@ public class MinionHelperRepoLoader { readyToUse = true; if (errorWhileLoading) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("what ever the minion helper wants"); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java index 7db8a21c..7b21e6a1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java @@ -729,7 +729,7 @@ public class BasicPage extends GuiProfileViewerPage { if (Weight.SLAYER_NAMES.contains(slayerNameLower)) { JsonObject slayerToTier = Constants.LEVELING.getAsJsonObject("slayer_to_highest_tier"); if (slayerToTier == null) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("leveling.json"); return; } @@ -827,7 +827,7 @@ public class BasicPage extends GuiProfileViewerPage { if (Constants.WEIGHT == null || Utils.getElement(Constants.WEIGHT, "lily.skills.overall") == null || !Utils.getElement(Constants.WEIGHT, "lily.skills.overall").isJsonPrimitive()) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("weight.json"); return; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java index 2d4e7250..e8e9f171 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java @@ -204,7 +204,7 @@ public class CollectionsPage extends GuiProfileViewerPage { } ProfileCollectionInfo.CollectionInfo thisCollection = collectionInfo.getCollections().get(collection); if (thisCollection == null) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("hypixel api collection info"); continue; } ItemStack collectionItem = ProfileViewer.getCollectionToCollectionDisplayMap().get(collection); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java index dc04fdef..d7eb6adb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java @@ -110,7 +110,7 @@ public class ExtraPage extends GuiProfileViewerPage { float mouseY ) { if (Constants.PARENTS == null || !Constants.PARENTS.has("ESSENCE_WITHER")) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("parents.json or missing ESSENCE_WITHER"); return; } @@ -129,7 +129,7 @@ public class ExtraPage extends GuiProfileViewerPage { TreeMap<String, JsonObject> itemInformation = NotEnoughUpdates.INSTANCE.manager.getItemInformation(); if (!itemInformation.containsKey(essenceName)) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification(essenceName); return; } String displayName = itemInformation.get(essenceName).getAsJsonObject().get("displayname").getAsString(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java index 0d298a71..809c5fb7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java @@ -165,7 +165,7 @@ public class PlayerStats { public static int getPetScore(JsonObject profile) { JsonObject bonuses = Constants.BONUSES; if (bonuses == null) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("bonuses.json"); return 0; } JsonElement petsElement = Utils.getElement(profile, "pets"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java index e930e41b..0440d018 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java @@ -523,7 +523,7 @@ public class SkyblockProfiles { private MuseumData(JsonObject museumJson) { JsonObject museum = Constants.MUSEUM; if (museum == null) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("museum.json"); museumValue = -3; return; } @@ -811,7 +811,7 @@ public class SkyblockProfiles { public EnumChatFormatting getSkyblockLevelColour() { if (Constants.SBLEVELS == null || !Constants.SBLEVELS.has("sblevel_colours")) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("sblevels.json or missing sblevel_colours"); return EnumChatFormatting.WHITE; } @@ -866,7 +866,7 @@ public class SkyblockProfiles { JsonObject leveling = Constants.LEVELING; if (leveling == null || !leveling.has("social")) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("leveling.json or missing social"); return null; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java index 6ce60674..60350fca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java @@ -76,7 +76,7 @@ public class LevelPage extends GuiProfileViewerPage { basicPage.drawSideButtons(); if (constant == null) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("sblevels.json"); return; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java index 77d6589c..2ca2788c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java @@ -95,7 +95,7 @@ public class EssenceTaskLevel extends GuiTaskLevel { .withKnownInternalName(key) .resolveToItemListJson(); if (jsonObject == null){ - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification(key); continue; } value.name = jsonObject diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java index fd56aca1..107aa38c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java @@ -176,7 +176,7 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{ int nucleusRuns = leveling.getAsJsonObject("completions").get("NUCLEUS_RUNS").getAsInt(); JsonElement nucleusXp = miningObj.get("crystal_nucleus_xp"); if (nucleusXp == null) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("crystal_nucleus_xp from sblevels.json"); } else { sbXpNucleus += nucleusRuns * nucleusXp.getAsInt(); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java index 825a963e..1e33c3ea 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java @@ -185,7 +185,7 @@ public class SlayingTaskLevel extends GuiTaskLevel { JsonArray defeatSlayersXp = slayingTask.get("defeat_slayers_xp").getAsJsonArray(); JsonObject slayerToTier = Constants.LEVELING.getAsJsonObject("slayer_to_highest_tier"); if (slayerToTier == null) { - Utils.showOutdatedRepoNotification(); + Utils.showOutdatedRepoNotification("slayer_to_highest_tier from leveling.json"); return; } for (Map.Entry<String, JsonElement> entry : slayerToTier.entrySet()) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 47549fec..f879631e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -2234,7 +2234,8 @@ public class Utils { return stringBuilder.toString(); } - public static void showOutdatedRepoNotification() { + private static long lastError = -1; + public static void showOutdatedRepoNotification(String missingFile) { if (NotEnoughUpdates.INSTANCE.config.notifications.outdatedRepo) { NotificationHandler.displayNotification(Lists.newArrayList( EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "Missing repo data", @@ -2253,6 +2254,10 @@ public class Utils { false, true ); } + if (System.currentTimeMillis() - lastError > 1000) { + System.err.println("[NEU] Repo issue: " + missingFile); + lastError = System.currentTimeMillis(); + } } /** diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.kt index 6cc4e255..e98dd7dd 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.kt @@ -40,7 +40,7 @@ class FeaturesCommand { reply("") val url = Constants.MISC?.get("featureslist")?.asString if (url == null) { - Utils.showOutdatedRepoNotification() + Utils.showOutdatedRepoNotification("misc.json or missing featureslist") return@thenExecute } diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.kt index 7a47da2b..dc995936 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.kt @@ -36,14 +36,14 @@ class LinksCommand { val manager = NotEnoughUpdates.INSTANCE.manager val updateJsonFile = manager.repoLocation.resolve("update.json") if (!updateJsonFile.exists()) { - Utils.showOutdatedRepoNotification() + Utils.showOutdatedRepoNotification("update.json") return@thenExecute } try { val updateJson = manager.getJsonFromFile(updateJsonFile) NotEnoughUpdates.INSTANCE.displayLinks(updateJson, 0) } catch (_: Exception) { - Utils.showOutdatedRepoNotification() + Utils.showOutdatedRepoNotification("some error with update.json") } } }.withHelp("Display links for Moulberry and NEU") diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt index 99066e52..9f809798 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt @@ -20,10 +20,10 @@ package io.github.moulberry.notenoughupdates.util import com.google.gson.JsonObject +import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay.Rarity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe @NEUAutoSubscribe object PetLeveling { @@ -94,7 +94,7 @@ object PetLeveling { } val stubExpLadder by lazy { - Utils.showOutdatedRepoNotification() + Utils.showOutdatedRepoNotification("pets.json") ExpLadder(listOf(1, 1)) } |