From 93ce36dcaffc31473136173dfb8987eeaece543a Mon Sep 17 00:00:00 2001 From: nopo Date: Wed, 25 Dec 2024 12:08:45 +1100 Subject: [PATCH] pls --- .../misc/visualwords/ModifyVisualWords.kt | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt index ca33b66907d3..83305d223dae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt @@ -22,6 +22,32 @@ object ModifyVisualWords { // Replacements the user added manually via /shwords var userModifiedWords = mutableListOf() + // Replacements the mod added automatically for some features, april jokes, etc + var modModifiedWords = mutableListOf() + private var finalWordsList = listOf() + private var debug = false + + fun update() { + finalWordsList = modModifiedWords + userModifiedWords + textCache.clear() + } + + @HandleEvent + fun onCommandRegistration(event: CommandRegistrationEvent) { + event.register("shdebugvisualwords") { + description = "Prints in the console all replaced words by /shwords" + callback { toggleDebug() } + } + } + + private fun toggleDebug() { + debug = !debug + ChatUtils.chat("Visual Words debug ${if (debug) "enabled" else "disabled"}") + if (debug) { + update() + } + } + fun modifyText(originalText: String?): String? { var modifiedText = originalText ?: return null if (!LorenzUtils.onHypixel) return originalText