diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-26 18:17:10 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-26 18:17:10 +0200 |
commit | 51cfe4de8e902e614ea73627fce7d34eabea2e62 (patch) | |
tree | 5f3da71724052c61ad2c08e112a86337971bcfd2 /src | |
parent | 4416d272a774be2afd89cf5fbe05595d41349fc7 (diff) | |
download | skyhanni-51cfe4de8e902e614ea73627fce7d34eabea2e62.tar.gz skyhanni-51cfe4de8e902e614ea73627fce7d34eabea2e62.tar.bz2 skyhanni-51cfe4de8e902e614ea73627fce7d34eabea2e62.zip |
Added support for tab completing the items with recipe in Hypixel command /viewrecipe.
Diffstat (limited to 'src')
4 files changed, 30 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 45042af50..76b3c0aa1 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -69,9 +69,9 @@ import at.hannibal2.skyhanni.features.combat.mobs.MobHighlight import at.hannibal2.skyhanni.features.combat.mobs.SpawnTimers import at.hannibal2.skyhanni.features.commands.PartyCommands import at.hannibal2.skyhanni.features.commands.SendCoordinatedCommand +import at.hannibal2.skyhanni.features.commands.ViewRecipeCommand import at.hannibal2.skyhanni.features.commands.WarpIsCommand import at.hannibal2.skyhanni.features.commands.WikiCommand -import at.hannibal2.skyhanni.features.commands.ViewRecipeCommand import at.hannibal2.skyhanni.features.commands.tabcomplete.GetFromSacksTabComplete import at.hannibal2.skyhanni.features.commands.tabcomplete.PlayerTabComplete import at.hannibal2.skyhanni.features.commands.tabcomplete.WarpTabComplete @@ -421,7 +421,7 @@ class SkyHanniMod { loadModule(WikiCommand()) loadModule(SendCoordinatedCommand()) loadModule(WarpIsCommand()) - loadModule(ViewRecipeCommand()) + loadModule(ViewRecipeCommand) loadModule(PartyCommands) loadModule(SummoningMobManager()) loadModule(AreaMiniBossFeatures()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java index 6f7607f9b..d1475d522 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java @@ -60,6 +60,12 @@ public class CommandsConfig { @ConfigEditorBoolean @FeatureToggle public boolean partyCommands = true; + + @Expose + @ConfigOption(name = "Viewrecipe Items", desc = "Tab complete items with recipe in the the Hypixel command §e/viewrecipe§7.") + @ConfigEditorBoolean + @FeatureToggle + public boolean viewrecipeItems = true; } @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt index 0563f21ee..4464959e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt @@ -3,10 +3,11 @@ package at.hannibal2.skyhanni.features.commands import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NEUItems import net.minecraft.network.play.client.C01PacketChatMessage import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ViewRecipeCommand { +object ViewRecipeCommand { private val config get() = SkyHanniMod.feature.commands @SubscribeEvent @@ -22,4 +23,22 @@ class ViewRecipeCommand { } } } + + val list by lazy { + val list = mutableListOf<String>() + for ((key, value) in NEUItems.manager.itemInformation) { + if (value.has("recipe")) { + list.add(key.lowercase()) + } + } + list + } + + fun customTabComplete(command: String): List<String>? { + if (command == "viewrecipe" && config.tabComplete.viewrecipeItems) { + return list + } + + return null + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/TabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/TabComplete.kt index 9c03e3a87..a835efd38 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/TabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/TabComplete.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.commands.tabcomplete import at.hannibal2.skyhanni.features.commands.PartyCommands +import at.hannibal2.skyhanni.features.commands.ViewRecipeCommand import at.hannibal2.skyhanni.features.misc.CollectionTracker object TabComplete { @@ -26,6 +27,7 @@ object TabComplete { PlayerTabComplete.handleTabComplete(command)?.let { return it } CollectionTracker.handleTabComplete(command)?.let { return it } PartyCommands.customTabComplete(command)?.let { return it } + ViewRecipeCommand.customTabComplete(command)?.let { return it } return null } |