aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2023-09-09 11:14:36 +0200
committerGitHub <noreply@github.com>2023-09-09 11:14:36 +0200
commit4a3114fac78902519762868a6107f6c74c9857a5 (patch)
tree891d761e2fde30e45f79d569052a8c039e4154b6 /src/main/java/at/hannibal2
parent3a134b646429e4a6ee7ab36fbc206ebb23cf9fc2 (diff)
downloadskyhanni-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')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java6
-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
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SackListJson.java11
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;
+}