From 6099ebfc0488b94769fcbdb42fd1d50801caf299 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 9 Sep 2023 11:17:03 +0200 Subject: code cleanup --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 4 ++-- .../misc/tabcomplete/GetFromSacksTabComplete.kt | 27 ++++++++++++++++++++++ .../features/misc/tabcomplete/GfsTabComplete.kt | 27 ---------------------- .../features/misc/tabcomplete/TabComplete.kt | 2 +- 4 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GetFromSacksTabComplete.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GfsTabComplete.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 a9c830393..719414e69 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -58,9 +58,9 @@ import at.hannibal2.skyhanni.features.misc.items.EstimatedWardrobePrice import at.hannibal2.skyhanni.features.misc.items.GlowingDroppedItems import at.hannibal2.skyhanni.features.misc.massconfiguration.DefaultConfigFeatures import at.hannibal2.skyhanni.features.misc.powdertracker.PowderTracker +import at.hannibal2.skyhanni.features.misc.tabcomplete.GetFromSacksTabComplete import at.hannibal2.skyhanni.features.misc.tabcomplete.PlayerTabComplete import at.hannibal2.skyhanni.features.misc.tabcomplete.WarpTabComplete -import at.hannibal2.skyhanni.features.misc.tabcomplete.GfsTabComplete import at.hannibal2.skyhanni.features.misc.teleportpad.TeleportPadCompactName import at.hannibal2.skyhanni.features.misc.teleportpad.TeleportPadInventoryNumber import at.hannibal2.skyhanni.features.misc.tiarelay.TiaRelayHelper @@ -344,7 +344,7 @@ class SkyHanniMod { loadModule(ShowFishingItemName()) loadModule(WarpTabComplete) loadModule(PlayerTabComplete) - loadModule(GfsTabComplete) + loadModule(GetFromSacksTabComplete) loadModule(SlayerItemProfitTracker) loadModule(SlayerItemsOnGround()) loadModule(RestorePieceOfWizardPortalLore()) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GetFromSacksTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GetFromSacksTabComplete.kt new file mode 100644 index 000000000..6368a94b7 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GetFromSacksTabComplete.kt @@ -0,0 +1,27 @@ +package at.hannibal2.skyhanni.features.misc.tabcomplete + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.jsonobjects.SackListJson +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +object GetFromSacksTabComplete { + private val config get() = SkyHanniMod.feature.misc.tabCompleteCommands + private var sackListJson: SackListJson? = null + private val commands = arrayOf("gfs", "getfromsacks") + + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + sackListJson = event.getConstant("Sacks") + } + + fun handleTabComplete(command: String): List? { + if (!isEnabled()) return null + if (command !in commands) return null + + return sackListJson?.sackList + } + + fun isEnabled() = LorenzUtils.inSkyBlock && config.gfsSack +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GfsTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GfsTabComplete.kt deleted file mode 100644 index a702f9390..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GfsTabComplete.kt +++ /dev/null @@ -1,27 +0,0 @@ -package at.hannibal2.skyhanni.features.misc.tabcomplete - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.RepositoryReloadEvent -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.jsonobjects.SackListJson -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -object GfsTabComplete { - private val config get() = SkyHanniMod.feature.misc.tabCompleteCommands - private var sackListJson: SackListJson? = null; - private val gfsCommands = arrayOf("gfs", "getfromsacks") - - @SubscribeEvent - fun onRepoReload(event: RepositoryReloadEvent) { - sackListJson = event.getConstant("Sacks") - } - - fun handleTabComplete(command: String): List? { - if (!isEnabled()) return null - if (command !in gfsCommands) return null - - return sackListJson?.sackList - } - - fun isEnabled() = LorenzUtils.inSkyBlock && config.gfsSack -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/TabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/TabComplete.kt index b8bb64f57..b003de699 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/TabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/TabComplete.kt @@ -20,7 +20,7 @@ object TabComplete { } private fun customTabComplete(command: String): List? { - GfsTabComplete.handleTabComplete(command)?.let { return it } + GetFromSacksTabComplete.handleTabComplete(command)?.let { return it } WarpTabComplete.handleTabComplete(command)?.let { return it } PlayerTabComplete.handleTabComplete(command)?.let { return it } CollectionTracker.handleTabComplete(command)?.let { return it } -- cgit