aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/chat/StashConfig.java9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/StashCompact.kt17
2 files changed, 21 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chat/StashConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chat/StashConfig.java
index 92fdd8c44..738f24c93 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/chat/StashConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/chat/StashConfig.java
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.config.features.chat;
import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorInfoText;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
@@ -14,6 +15,14 @@ public class StashConfig {
@FeatureToggle
public boolean enabled = true;
+ @ConfigOption(
+ name = "§cNotice",
+ desc = "Hypixel sends un-detectable empty messages wrapping the stash message. " +
+ "Enable §e§l/sh empty messages §r§7to hide them."
+ )
+ @ConfigEditorInfoText
+ public String notice = "";
+
@Expose
@ConfigOption(name = "Hide Duplicate Warnings", desc = "Hide duplicate warnings for previously reported stash counts.")
@ConfigEditorBoolean
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/StashCompact.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/StashCompact.kt
index bcb4f6194..c33aac591 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/StashCompact.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/StashCompact.kt
@@ -23,10 +23,11 @@ object StashCompact {
/**
* REGEX-TEST: §f §7You have §3226 §7materials stashed away!
* REGEX-TEST: §f §7You have §31,000 §7items stashed away!
+ * REGEX-TEST: §f §7You have §a2 §7items stashed away!
*/
private val materialCountPattern by patternGroup.pattern(
"material.count",
- "§f *§7You have §3(?<count>[\\d,]+) (?:§.)+(?<type>item|material)s? stashed away!.*",
+ "§f *§7You have §.(?<count>[\\d,]+) (?:§.)+(?<type>item|material)s? stashed away!.*",
)
/**
@@ -42,10 +43,11 @@ object StashCompact {
/**
* REGEX-TEST: §f §3§l>>> §3§lCLICK HERE§b to pick them up! §3§l<<<
+ * REGEX-TEST: §f §6§l>>> §6§lCLICK HERE§e to pick them up! §6§l<<<
*/
private val pickupStashPattern by patternGroup.pattern(
"pickup.stash",
- "§f *§3§l>>> §3§lCLICK HERE§b to pick (?:them|it) up! §3§l<<<.*",
+ "§f *§.§l>>> §.§lCLICK HERE§. to pick (?:them|it) up! §.§l<<<.*",
)
/**
@@ -104,10 +106,12 @@ object StashCompact {
private fun sendCompactedStashMessage() {
val typeNameFormat = StringUtils.pluralize(lastMaterialCount, lastType)
- val typeFormat = StringUtils.pluralize(lastDifferingMaterialsCount, "type")
+ val typeStringExtra = lastDifferingMaterialsCount.let {
+ if (it == 0) "." else ", §etotalling §6$it ${StringUtils.pluralize(it, "type")}§6."
+ }
+
ChatUtils.clickableChat(
- "§eYou have §6$lastMaterialCount §e$typeNameFormat in stash§6, " +
- "§etotalling §6$lastDifferingMaterialsCount $typeFormat§6. " +
+ "§eYou have §6$lastMaterialCount §e$typeNameFormat in stash§6${typeStringExtra} " +
"§eClick to ${if (config.useViewStash) "§6view" else "§6pickup"} §estash§6.",
onClick = {
if (config.useViewStash) HypixelCommands.viewStash(lastType)
@@ -116,6 +120,9 @@ object StashCompact {
)
lastSentMaterialCount = lastMaterialCount
lastSentType = lastType
+ // Dirty, but item stash doesn't always have differing materials count,
+ // and we don't compare this value to the last one, so we can reset it here
+ lastDifferingMaterialsCount = 0
}
private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled