aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/GfsTabComplete.kt27
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/TabComplete.kt1
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 }