From 854a1f71eac59e6f8f0d1f2680124f06823b76b7 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 8 Dec 2023 15:04:11 +0100 Subject: code cleanup --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 7 +++---- src/main/java/at/hannibal2/skyhanni/events/PreInitFinished.kt | 3 --- src/main/java/at/hannibal2/skyhanni/events/PreInitFinishedEvent.kt | 3 +++ .../java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt | 2 +- .../at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGui.kt | 6 +++--- .../at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt | 7 ++++--- 6 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/events/PreInitFinished.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/PreInitFinishedEvent.kt (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 7db9976e8..b41b894cb 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -46,6 +46,7 @@ import at.hannibal2.skyhanni.data.jsonobjects.local.JacobContestsJson import at.hannibal2.skyhanni.data.jsonobjects.local.KnownFeaturesJson import at.hannibal2.skyhanni.data.repo.RepoManager import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.PreInitFinishedEvent import at.hannibal2.skyhanni.features.anvil.AnvilCombineHelper import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.bazaar.BazaarBestSellMethod @@ -56,9 +57,6 @@ import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.bingo.CompactBingoChat import at.hannibal2.skyhanni.features.bingo.MinionCraftHelper import at.hannibal2.skyhanni.features.bingo.card.BingoCardDisplay -import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import at.hannibal2.skyhanni.utils.repopatterns.RepoPatternManager -import at.hannibal2.skyhanni.events.PreInitFinished import at.hannibal2.skyhanni.features.bingo.card.BingoCardReader import at.hannibal2.skyhanni.features.bingo.card.BingoCardTips import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.BingoNextStepHelper @@ -329,6 +327,7 @@ import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.MinecraftConsoleFilter.Companion.initLogging import at.hannibal2.skyhanni.utils.NEUVersionCheck.checkIfNeuIsLoaded import at.hannibal2.skyhanni.utils.TabListData +import at.hannibal2.skyhanni.utils.repopatterns.RepoPatternManager import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job @@ -684,7 +683,7 @@ class SkyHanniMod { loadModule(TestShowSlotNumber()) loadModule(SkyHanniDebugsAndTests) loadModule(HotSwapDetection) - PreInitFinished().postAndCatch() + PreInitFinishedEvent().postAndCatch() } @Mod.EventHandler diff --git a/src/main/java/at/hannibal2/skyhanni/events/PreInitFinished.kt b/src/main/java/at/hannibal2/skyhanni/events/PreInitFinished.kt deleted file mode 100644 index 9b36f8826..000000000 --- a/src/main/java/at/hannibal2/skyhanni/events/PreInitFinished.kt +++ /dev/null @@ -1,3 +0,0 @@ -package at.hannibal2.skyhanni.events - -class PreInitFinished : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/PreInitFinishedEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PreInitFinishedEvent.kt new file mode 100644 index 000000000..8294b8bd7 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/PreInitFinishedEvent.kt @@ -0,0 +1,3 @@ +package at.hannibal2.skyhanni.events + +class PreInitFinishedEvent : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt index ec5065d5f..8f0c6be6a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt @@ -33,7 +33,7 @@ object HarpFeatures { } private val buttonColors = listOf('d', 'e', 'a', '2', '5', '9', 'b') - val inventoryTitleRegex by RepoPattern.pattern("harp.inventory", "^Harp.*") + private val inventoryTitleRegex by RepoPattern.pattern("harp.inventory", "^Harp.*") private fun isHarpGui() = inventoryTitleRegex.matches(openInventoryName()) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGui.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGui.kt index b70d54edd..2a2393686 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGui.kt @@ -28,11 +28,11 @@ class RepoPatternGui private constructor() { @field:Bind var search: String = "" - var lastSearch = null as String? - val allKeys = RepoPatternManager.allPatterns.toList() + private var lastSearch = null as String? + private val allKeys = RepoPatternManager.allPatterns.toList() .sortedBy { it.key } .map { RepoPatternInfo(it) } - var searchCache = ObservableList(mutableListOf()) + private var searchCache = ObservableList(mutableListOf()) class RepoPatternInfo( diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt index 9ebd6c145..5140aa186 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt @@ -4,8 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzEvent -import at.hannibal2.skyhanni.events.PreInitFinished +import at.hannibal2.skyhanni.events.PreInitFinishedEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange import at.hannibal2.skyhanni.utils.StringUtils.matches import net.minecraft.launchwrapper.Launch import net.minecraftforge.fml.common.FMLCommonHandler @@ -74,7 +75,7 @@ object RepoPatternManager { @SubscribeEvent fun onConfigInit(event: ConfigLoadEvent) { - config.forceLocal.whenChanged { b, b2 -> reloadPatterns() } + config.forceLocal.afterChange { reloadPatterns() } } /** @@ -127,7 +128,7 @@ object RepoPatternManager { } @SubscribeEvent - fun onPreInitFinished(event: PreInitFinished) { + fun onPreInitFinished(event: PreInitFinishedEvent) { wasPreinitialized = true val dumpDirective = System.getenv("SKYHANNI_DUMP_REGEXES") if (dumpDirective.isNullOrBlank()) return -- cgit