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 --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 ++ .../at/hannibal2/skyhanni/config/features/Misc.java | 2 +- .../features/misc/tabcomplete/PlayerTabComplete.kt | 17 ++++++++++++++--- .../skyhanni/utils/jsonobjects/VipVisitsJson.java | 11 +++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/VipVisitsJson.java (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 05b2d0cdb..b5f1a8a24 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -44,6 +44,7 @@ import at.hannibal2.skyhanni.features.misc.* import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue import at.hannibal2.skyhanni.features.misc.items.EstimatedWardrobePrice +import at.hannibal2.skyhanni.features.misc.tabcomplete.PlayerTabComplete import at.hannibal2.skyhanni.features.misc.tabcomplete.WarpTabComplete import at.hannibal2.skyhanni.features.misc.teleportpad.TeleportPadCompactName import at.hannibal2.skyhanni.features.misc.teleportpad.TeleportPadInventoryNumber @@ -291,6 +292,7 @@ class SkyHanniMod { loadModule(PocketSackInASackDisplay()) loadModule(ShowFishingItemName()) loadModule(WarpTabComplete) + loadModule(PlayerTabComplete) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index dfbe7c4c4..0402c1ae2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -418,7 +418,7 @@ public class Misc { public boolean party = true; @Expose - @ConfigOption(name = "VIP Visits", desc = "Tab complete the visit to special users like PortalHub or prtlhub") + @ConfigOption(name = "VIP Visits", desc = "Tab complete the visit to special users with cake souls on it.") @ConfigEditorBoolean public boolean vipVisits = true; } 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) + } + } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/VipVisitsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/VipVisitsJson.java new file mode 100644 index 000000000..f0490e72e --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/VipVisitsJson.java @@ -0,0 +1,11 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.List; + +public class VipVisitsJson { + + @Expose + public List vipVisits; +} -- cgit