aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt
index 0944ca9ad..009478787 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt
@@ -226,25 +226,30 @@ enum class DiscordStatus(private val displayMessageSupplier: (() -> String?)) {
DiscordRPCManager.config.customText.get() // custom field in the config
}),
- AUTO({
- var autoReturn = ""
- for (statusID in DiscordRPCManager.config.autoPriority) { // for every dynamic that the user wants to see...
- // TODO, change functionality to use enum rather than ordinals
- val autoStatus = AutoStatus.entries[statusID.ordinal]
- val result =
- autoStatus.correspondingDiscordStatus.getDisplayString() // get what would happen if we were to display it
- if (result != autoStatus.placeholderText) { // if that value is useful, display it
- autoReturn = result
- break
+ AUTO(
+ {
+ var autoReturn = ""
+ for (statusID in DiscordRPCManager.config.autoPriority) { // for every dynamic that the user wants to see...
+ // TODO, change functionality to use enum rather than ordinals
+ val autoStatus = AutoStatus.entries[statusID.ordinal]
+ val result =
+ autoStatus.correspondingDiscordStatus.getDisplayString() // get what would happen if we were to display it
+ if (result != autoStatus.placeholderText) { // if that value is useful, display it
+ autoReturn = result
+ break
+ }
}
- }
- if (autoReturn == "") { // if we didn't find any useful information, display the fallback
- val statusNoAuto = DiscordStatus.entries.toMutableList()
- statusNoAuto.remove(AUTO)
- autoReturn = statusNoAuto[DiscordRPCManager.config.auto.get().ordinal].getDisplayString()
- }
- autoReturn
- }),
+ if (autoReturn == "") { // if we didn't find any useful information, display the fallback
+ val fallbackID = DiscordRPCManager.config.auto.get().ordinal
+ autoReturn = if (fallbackID == 10) {
+ NONE.getDisplayString() // 10 is this (DiscordStatus.AUTO); prevents an infinite loop
+ } else {
+ DiscordStatus.entries[fallbackID].getDisplayString()
+ }
+ }
+ autoReturn
+ },
+ ),
CROP_MILESTONES({ getCropMilestoneDisplay() }),