aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-06 00:18:11 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-06 00:19:08 +0200
commite0db080c259b969029f710a6cc08625afb0b58b5 (patch)
tree5e951c0ac6fa14db3eec510ea0fc908d7e6d070c /src/main/java
parent01d97520af807c32b2386ba0702a171819fa3009 (diff)
downloadskyhanni-e0db080c259b969029f710a6cc08625afb0b58b5.tar.gz
skyhanni-e0db080c259b969029f710a6cc08625afb0b58b5.tar.bz2
skyhanni-e0db080c259b969029f710a6cc08625afb0b58b5.zip
Workaround to not crash if visitor rarities is empty
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt18
1 files changed, 12 insertions, 6 deletions
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 fef655811..62552bfbf 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
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.PreProfileSwitchEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
+import at.hannibal2.skyhanni.test.command.CopyErrorCommand
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.NEUItems
@@ -104,12 +105,17 @@ object GardenVisitorDropStatistics {
//1
addAsSingletonList(format(totalVisitors, "Total", "§e", ""))
//2
- addAsSingletonList(
- "§a${visitorRarities[0].addSeparators()}§f-" +
- "§9${visitorRarities[1].addSeparators()}§f-" +
- "§6${visitorRarities[2].addSeparators()}§f-" +
- "§c${visitorRarities[3].addSeparators()}"
- )
+ if (visitorRarities.isNotEmpty()) {
+ addAsSingletonList(
+ "§a${visitorRarities[0].addSeparators()}§f-" +
+ "§9${visitorRarities[1].addSeparators()}§f-" +
+ "§6${visitorRarities[2].addSeparators()}§f-" +
+ "§c${visitorRarities[3].addSeparators()}"
+ )
+ } else {
+ addAsSingletonList("§c?")
+ CopyErrorCommand.logError(RuntimeException("visitorRarities is empty, maybe visitor refusing was the cause?"), "Error rendering visitor drop statistics")
+ }
//3
addAsSingletonList(format(acceptedVisitors, "Accepted", "§2", ""))
//4