diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-03-22 18:16:36 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-03-22 18:16:36 +0100 |
commit | 788adb59f20e01c83f4e030fa077a70275c00074 (patch) | |
tree | fca6631ca0f5962669154e9bdfb42119cff69c35 /src/main/java/at/hannibal2/skyhanni/features | |
parent | eb0624abe02204461222b980e9cf395e1ddbdbd8 (diff) | |
parent | 527580c5c6362594909c83213f7d6838790a3ef6 (diff) | |
download | skyhanni-788adb59f20e01c83f4e030fa077a70275c00074.tar.gz skyhanni-788adb59f20e01c83f4e030fa077a70275c00074.tar.bz2 skyhanni-788adb59f20e01c83f4e030fa077a70275c00074.zip |
Merge remote-tracking branch 'origin/beta' into beta
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt | 15 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt | 12 |
2 files changed, 21 insertions, 6 deletions
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 9198438aa..55d9b7202 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 @@ -1,10 +1,13 @@ package at.hannibal2.skyhanni.features.misc.visualwords import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.enums.OutsideSbFeature +import at.hannibal2.skyhanni.events.HypixelJoinEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.convertToFormatted import at.hannibal2.skyhanni.utils.TimeLimitedCache +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes object ModifyVisualWords { @@ -21,7 +24,7 @@ object ModifyVisualWords { if (!LorenzUtils.inSkyBlock && !OutsideSbFeature.MODIFY_VISUAL_WORDS.isSelected()) return originalText if (modifiedWords.isEmpty()) { - modifiedWords = SkyHanniMod.feature.storage.modifiedWords + modifiedWords.addAll(SkyHanniMod.visualWordsData.modifiedWords) } val cachedResult = textCache.getOrNull(originalText) @@ -49,4 +52,14 @@ object ModifyVisualWords { textCache.put(originalText, modifiedText) return modifiedText } + + @SubscribeEvent + fun onHypixelJoin(event: HypixelJoinEvent) { + val oldModifiedWords = SkyHanniMod.feature.storage.modifiedWords + if (oldModifiedWords.isNotEmpty()) { + SkyHanniMod.visualWordsData.modifiedWords = oldModifiedWords + SkyHanniMod.feature.storage.modifiedWords = emptyList() + SkyHanniMod.configManager.saveConfig(ConfigFileType.VISUAL_WORDS, "Migrate visual words") + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index 387a3e222..e41803ffb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.visualwords import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils.chat @@ -231,7 +232,7 @@ open class VisualWordGui : GuiScreen() { } if (modifiedWords.size < 1) { - modifiedWords = SkyHanniMod.feature.storage.modifiedWords + modifiedWords = ModifyVisualWords.modifiedWords } if (toRemove != null) { @@ -444,7 +445,7 @@ open class VisualWordGui : GuiScreen() { currentText = "" currentIndex = modifiedWords.size - 1 saveChanges() - pageScroll = -(SkyHanniMod.feature.storage.modifiedWords.size * 30 - 100) + pageScroll = -(modifiedWords.size * 30 - 100) scrollScreen() } currentlyEditing = !currentlyEditing @@ -465,7 +466,7 @@ open class VisualWordGui : GuiScreen() { if (!currentlyEditing) { if (keyCode == Keyboard.KEY_DOWN || keyCode == Keyboard.KEY_S) { if (KeyboardManager.isModifierKeyDown()) { - pageScroll = -(SkyHanniMod.feature.storage.modifiedWords.size * 30 - 100) + pageScroll = -(modifiedWords.size * 30 - 100) } else { pageScroll -= 30 } @@ -549,14 +550,15 @@ open class VisualWordGui : GuiScreen() { pageScroll = 0 } - pageScroll = MathHelper.clamp_int(pageScroll, -(SkyHanniMod.feature.storage.modifiedWords.size * 30 - 100), 0) + pageScroll = MathHelper.clamp_int(pageScroll, -(modifiedWords.size * 30 - 100), 0) lastMouseScroll = 0 } private fun saveChanges() { ModifyVisualWords.modifiedWords = modifiedWords ModifyVisualWords.textCache.clear() - SkyHanniMod.feature.storage.modifiedWords = modifiedWords + SkyHanniMod.visualWordsData.modifiedWords = modifiedWords + SkyHanniMod.configManager.saveConfig(ConfigFileType.VISUAL_WORDS, "Updated visual words") } private fun tryImportFromSBE() { |