diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-21 18:48:55 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-21 18:48:55 +0100 |
commit | 46399eb4ef9212935853bdd1c0af191cb6b76503 (patch) | |
tree | 1685fe4e7fd8bcdad481d4791d8a6ed9e72d9599 /src | |
parent | c9dcfa040934df376e1bab2c893b466f2323829c (diff) | |
download | skyhanni-46399eb4ef9212935853bdd1c0af191cb6b76503.tar.gz skyhanni-46399eb4ef9212935853bdd1c0af191cb6b76503.tar.bz2 skyhanni-46399eb4ef9212935853bdd1c0af191cb6b76503.zip |
Removed message when crop milestones look different in the menu than stored SkyHanni data.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt | 4 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt (renamed from src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesFix.kt) | 34 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java | 3 |
5 files changed, 35 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index f2d250226..a7c3584b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.data.EntityMovementData import at.hannibal2.skyhanni.data.FriendAPI import at.hannibal2.skyhanni.data.GardenComposterUpgradesData import at.hannibal2.skyhanni.data.GardenCropMilestones +import at.hannibal2.skyhanni.data.GardenCropMilestonesCommunityFix import at.hannibal2.skyhanni.data.GardenCropUpgrades import at.hannibal2.skyhanni.data.GuiEditManager import at.hannibal2.skyhanni.data.GuildAPI @@ -362,6 +363,7 @@ class SkyHanniMod { loadModule(TabListData()) loadModule(RenderData()) loadModule(GardenCropMilestones) + loadModule(GardenCropMilestonesCommunityFix) loadModule(GardenCropUpgrades()) loadModule(VisitorListener()) loadModule(OwnInventoryData()) 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 641dc912d..8e4791901 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigGuiManager import at.hannibal2.skyhanni.data.ChatManager -import at.hannibal2.skyhanni.data.GardenCropMilestonesFix +import at.hannibal2.skyhanni.data.GardenCropMilestonesCommunityFix import at.hannibal2.skyhanni.data.GuiEditManager import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.features.bingo.BingoCardDisplay @@ -318,7 +318,7 @@ object Commands { registerCommand( "readcropmilestonefromclipboard", "Read crop milestone from clipboard. This helps fixing wrong crop milestone data" - ) { GardenCropMilestonesFix.readDataFromClipboard() } + ) { GardenCropMilestonesCommunityFix.readDataFromClipboard() } } private fun internalCommands() { diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt index d810121ed..610393906 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt @@ -41,7 +41,7 @@ object GardenCropMilestones { } } CropMilestoneUpdateEvent().postAndCatch() - GardenCropMilestonesFix.openInventory(event.inventoryItems) + GardenCropMilestonesCommunityFix.openInventory(event.inventoryItems) } var cropMilestoneData: Map<CropType, List<Int>> = emptyMap() diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesFix.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt index cad8fdddf..c97997262 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager -import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent +import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -16,16 +16,34 @@ import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.jsonobjects.GardenJson import kotlinx.coroutines.launch import net.minecraft.item.ItemStack +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -object GardenCropMilestonesFix { +object GardenCropMilestonesCommunityFix { private val pattern = ".*§e(?<having>.*)§6/§e(?<max>.*)".toPattern() + private var showWrongData = false + private var showWhenAllCorrect = false + + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + val data = event.getConstant<GardenJson>("Garden") + val map = data.crop_milestone_community_help ?: return + for ((key, value) in map) { + if (key == "show_wrong_data") { + showWrongData = value + } + if (key == "show_when_all_correct") { + showWhenAllCorrect = value + } + } + } fun openInventory(inventoryItems: Map<Int, ItemStack>) { - if (SkyHanniMod.feature.garden.copyMilestoneData) { - fixForWrongData(inventoryItems) - } + if (!showWrongData) return + if (!SkyHanniMod.feature.garden.copyMilestoneData) return + fixForWrongData(inventoryItems) } private fun fixForWrongData(inventoryItems: Map<Int, ItemStack>) { @@ -44,8 +62,10 @@ object GardenCropMilestonesFix { "Please share it on the §bSkyHanni Discord §ein the channel §b#share-data§e." ) OSUtils.copyToClipboard("```${data.joinToString("\n")}```") -// } else { -// LorenzUtils.chat("No wrong crop milestone steps found!") + } else { + if (showWhenAllCorrect) { + LorenzUtils.chat("No wrong crop milestone steps found!") + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java index cc8bcd51d..7bc9cf7fa 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java @@ -17,6 +17,9 @@ public class GardenJson { public Map<CropType, List<Integer>> crop_milestones; @Expose + public Map<String, Boolean> crop_milestone_community_help; + + @Expose public Map<String, GardenVisitor> visitors; @Expose |