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 | |
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')
5 files changed, 47 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 400f47497..a9c830393 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -60,6 +60,7 @@ import at.hannibal2.skyhanni.features.misc.massconfiguration.DefaultConfigFeatur import at.hannibal2.skyhanni.features.misc.powdertracker.PowderTracker 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 @@ -343,6 +344,7 @@ class SkyHanniMod { loadModule(ShowFishingItemName()) loadModule(WarpTabComplete) loadModule(PlayerTabComplete) + loadModule(GfsTabComplete) loadModule(SlayerItemProfitTracker) loadModule(SlayerItemsOnGround()) loadModule(RestorePieceOfWizardPortalLore()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 945468fcb..2a9bce6bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -540,6 +540,12 @@ public class MiscConfig { @ConfigEditorBoolean @FeatureToggle public boolean vipVisits = true; + + @Expose + @ConfigOption(name = "/gfs Sack", desc = "Tab complete /gfs sack items.") + @ConfigEditorBoolean + @FeatureToggle + public boolean gfsSack = true; } @ConfigOption(name = "Pocket Sack-In-A-Sack", desc = "") 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 } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SackListJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SackListJson.java new file mode 100644 index 000000000..c554ddb24 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SackListJson.java @@ -0,0 +1,11 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.List; + +public class SackListJson { + + @Expose + public List<String> sackList; +} |