diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2023-09-09 11:14:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-09 11:14:36 +0200 |
commit | 4a3114fac78902519762868a6107f6c74c9857a5 (patch) | |
tree | 891d761e2fde30e45f79d569052a8c039e4154b6 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | 3a134b646429e4a6ee7ab36fbc206ebb23cf9fc2 (diff) | |
download | skyhanni-4a3114fac78902519762868a6107f6c74c9857a5.tar.gz skyhanni-4a3114fac78902519762868a6107f6c74c9857a5.tar.bz2 skyhanni-4a3114fac78902519762868a6107f6c74c9857a5.zip |
Added gfs tab complete (#454)
Added gfs tab complete #454
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GfsTabComplete.kt | 27 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/TabComplete.kt | 1 |
2 files changed, 28 insertions, 0 deletions
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 new file mode 100644 index 000000000..a702f9390 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GfsTabComplete.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 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<SackListJson>("Sacks") + } + + fun handleTabComplete(command: String): List<String>? { + 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 8e13d3a1d..b8bb64f57 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,6 +20,7 @@ object TabComplete { } private fun customTabComplete(command: String): List<String>? { + GfsTabComplete.handleTabComplete(command)?.let { return it } WarpTabComplete.handleTabComplete(command)?.let { return it } PlayerTabComplete.handleTabComplete(command)?.let { return it } CollectionTracker.handleTabComplete(command)?.let { return it } |