From 7f36ca139131f02ca231ae9c1fbcc678498e633f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 4 Jun 2023 23:44:30 +0200 Subject: Added repo support for vip visits --- .../features/misc/tabcomplete/PlayerTabComplete.kt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt index c20b64b7f..6f1aef392 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt @@ -3,10 +3,19 @@ package at.hannibal2.skyhanni.features.misc.tabcomplete import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.FriendAPI import at.hannibal2.skyhanni.data.PartyAPI +import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.jsonobjects.VipVisitsJson +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object PlayerTabComplete { private val config get() = SkyHanniMod.feature.misc.tabCompleteCommands + private var vipVisitsJson: VipVisitsJson? = null + + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + vipVisitsJson = event.getConstant("VipVisits") + } enum class PlayerCategory { PARTY, @@ -36,7 +45,6 @@ object PlayerTabComplete { ) val ignored = commands[command] ?: return null - return buildList { if (config.friends) { @@ -67,8 +75,11 @@ object PlayerTabComplete { if (config.vipVisits) { if (command == "visit") { - add("prtlhub") - add("PortalHub") + vipVisitsJson?.let { + for (visit in it.vipVisits) { + add(visit) + } + } } } } -- cgit