From 1aed35c84c55688222818d2333059f9790db3c36 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 5 Nov 2023 13:31:02 +0100 Subject: using visitorDrops.visitorRarities directly from the config instead of accessing the local field. hopefully this will prevent partial config resets in the future. --- .../features/garden/visitor/GardenVisitorDropStatistics.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index c4b7fc0a3..6a9d53e15 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -29,7 +29,6 @@ object GardenVisitorDropStatistics { private var acceptedVisitors = 0 var deniedVisitors = 0 private var totalVisitors = 0 - private var visitorRarities = mutableListOf() var coinsSpent = 0L var lastAccept = 0L @@ -117,6 +116,7 @@ object GardenVisitorDropStatistics { private fun setRarities(rarity: String) { acceptedVisitors += 1 val currentRarity = VisitorRarity.valueOf(rarity) + val visitorRarities = GardenAPI.config?.visitorDrops?.visitorRarities ?: return val temp = visitorRarities[currentRarity.ordinal] + 1 visitorRarities[currentRarity.ordinal] = temp saveAndUpdate() @@ -128,6 +128,7 @@ object GardenVisitorDropStatistics { //1 addAsSingletonList(format(totalVisitors, "Total", "§e", "")) //2 + val visitorRarities = hidden.visitorRarities if (visitorRarities.isNotEmpty()) { addAsSingletonList( "§a${visitorRarities[0].addSeparators()}§f-" + @@ -197,7 +198,6 @@ object GardenVisitorDropStatistics { hidden.acceptedVisitors = acceptedVisitors hidden.deniedVisitors = deniedVisitors totalVisitors = acceptedVisitors + deniedVisitors - hidden.visitorRarities = visitorRarities hidden.coinsSpent = coinsSpent hidden.rewardsCount = rewardsCount display = formatDisplay(drawDisplay(hidden)) @@ -215,7 +215,6 @@ object GardenVisitorDropStatistics { acceptedVisitors = hidden.acceptedVisitors deniedVisitors = hidden.deniedVisitors totalVisitors = acceptedVisitors + deniedVisitors - visitorRarities = hidden.visitorRarities coinsSpent = hidden.coinsSpent rewardsCount = hidden.rewardsCount saveAndUpdate() @@ -243,4 +242,4 @@ object GardenVisitorDropStatistics { enum class VisitorRarity { UNCOMMON, RARE, LEGENDARY, SPECIAL, -} \ No newline at end of file +} -- cgit