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/main/java/at/hannibal2/skyhanni/data | |
| 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/main/java/at/hannibal2/skyhanni/data')
| -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 |
2 files changed, 28 insertions, 8 deletions
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!") + } } } |
