diff options
Diffstat (limited to 'src/main')
16 files changed, 72 insertions, 90 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 57889cc48..8cce72bba 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -8,14 +8,18 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.bingo.BingoAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData +import at.hannibal2.skyhanni.utils.UtilsPatterns import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import com.google.gson.JsonObject import io.github.moulberry.notenoughupdates.NotEnoughUpdates @@ -25,14 +29,11 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.network.FMLNetworkEvent import kotlin.concurrent.thread +import kotlin.time.Duration.Companion.seconds class HypixelData { private val patternGroup = RepoPattern.group("data.hypixeldata") - private val tabListProfilePattern by patternGroup.pattern( - "tablistprofile", - "§e§lProfile: §r§a(?<profile>.*)" - ) private val lobbyTypePattern by patternGroup.pattern( "lobbytype", "(?<lobbyType>.*lobby)\\d+" @@ -42,10 +43,9 @@ class HypixelData { "(?:§.)*(Area|Dungeon): (?:§.)*(?<island>.*)" ) - private var lastLocRaw = 0L + private var lastLocRaw = SimpleTimeMark.farPast() companion object { - private val patternGroup = RepoPattern.group("data.hypixeldata") private val serverIdScoreboardPattern by patternGroup.pattern( "serverid.scoreboard", @@ -147,6 +147,7 @@ class HypixelData { val message = event.message.removeColor().lowercase() if (message.startsWith("your profile was changed to:")) { val newProfile = message.replace("your profile was changed to:", "").replace("(co-op)", "").trim() + if (profileName == newProfile) return profileName = newProfile ProfileJoinEvent(newProfile).postAndCatch() } @@ -159,6 +160,21 @@ class HypixelData { } @SubscribeEvent + fun onTabListUpdate(event: TabListUpdateEvent) { + for (line in event.tabList) { + UtilsPatterns.tabListProfilePattern.matchMatcher(line) { + var newProfile = group("profile").lowercase() + // Hypixel shows the profile name reversed while in the Rift + if (RiftAPI.inRift()) newProfile = newProfile.reversed() + if (profileName == newProfile) return + profileName = newProfile + ProfileJoinEvent(newProfile).postAndCatch() + return + } + } + } + + @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.inSkyBlock) { // Modified from NEU. @@ -169,9 +185,9 @@ class HypixelData { val currentTime = System.currentTimeMillis() if (LorenzUtils.onHypixel && locrawData == null && - currentTime - lastLocRaw > 15000 + lastLocRaw.passedSince() > 15.seconds ) { - lastLocRaw = System.currentTimeMillis() + lastLocRaw = SimpleTimeMark.now() thread(start = true) { Thread.sleep(1000) NotEnoughUpdates.INSTANCE.sendChatMessage("/locraw") @@ -213,7 +229,7 @@ class HypixelData { private fun checkProfileName(): Boolean { if (profileName.isEmpty()) { val text = TabListData.getTabList().firstOrNull { it.contains("Profile:") } ?: return true - tabListProfilePattern.matchMatcher(text) { + UtilsPatterns.tabListProfilePattern.matchMatcher(text) { profileName = group("profile").lowercase() ProfileJoinEvent(profileName).postAndCatch() } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt index 08894d4a3..b81e09640 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt @@ -3,18 +3,21 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.SackData import at.hannibal2.skyhanni.config.Storage +import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.HypixelJoinEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.UtilsPatterns import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import kotlin.time.Duration.Companion.seconds import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -23,7 +26,7 @@ object ProfileStorageData { var playerSpecific: Storage.PlayerSpecific? = null var profileSpecific: Storage.ProfileSpecific? = null var loaded = false - private var noTabListTime = -1L + private var noTabListTime = SimpleTimeMark.farPast() private var nextProfile: String? = null @@ -32,44 +35,11 @@ object ProfileStorageData { "switch", "§7Switching to profile (?<name>.*)\\.\\.\\." ) - private val profileNamePattern by patternGroup.pattern( - "name", - "§e§lProfile: §r§a(?<name>.*)" - ) - private var sackPlayers: SackData.PlayerSpecific? = null var sackProfiles: SackData.ProfileSpecific? = null @SubscribeEvent(priority = EventPriority.HIGHEST) - fun onChat(event: LorenzChatEvent) { - profileSwitchPattern.matchMatcher(event.message) { - nextProfile = group("name").lowercase() - loaded = false - PreProfileSwitchEvent().postAndCatch() - } - } - - @SubscribeEvent(priority = EventPriority.HIGHEST) - fun onWorldChange(event: LorenzWorldChangeEvent) { - val profileName = nextProfile ?: return - nextProfile = null - - val playerSpecific = playerSpecific - val sackPlayers = sackPlayers - if (playerSpecific == null) { - ChatUtils.error("profileSpecific after profile swap can not be set: playerSpecific is null!") - return - } - if (sackPlayers == null) { - ChatUtils.error("sackPlayers after profile swap can not be set: sackPlayers is null!") - return - } - loadProfileSpecific(playerSpecific, sackPlayers, profileName) - ConfigLoadEvent().postAndCatch() - } - - @SubscribeEvent(priority = EventPriority.HIGHEST) fun onProfileJoin(event: ProfileJoinEvent) { val playerSpecific = playerSpecific val sackPlayers = sackPlayers @@ -78,42 +48,36 @@ object ProfileStorageData { return } if (sackPlayers == null) { - ChatUtils.error("sackPlayers is null in sackPlayers!") + ChatUtils.error("sackPlayers is null in ProfileJoinEvent!") return } - if (profileSpecific == null) { - val profileName = event.name - loadProfileSpecific(playerSpecific, sackPlayers, profileName) - } + val profileName = event.name + loadProfileSpecific(playerSpecific, sackPlayers, profileName) + ConfigLoadEvent().postAndCatch() } @SubscribeEvent fun onTabListUpdate(event: TabListUpdateEvent) { - if (profileSpecific != null) return - val playerSpecific = playerSpecific ?: return - val sackPlayers = sackPlayers ?: return + if (!LorenzUtils.inSkyBlock) return + for (line in event.tabList) { - profileNamePattern.matchMatcher(line) { - val profileName = group("name").lowercase() - loadProfileSpecific(playerSpecific, sackPlayers, profileName) - nextProfile = null + UtilsPatterns.tabListProfilePattern.matchMatcher(line) { + noTabListTime = SimpleTimeMark.farPast() return } } - if (LorenzUtils.inSkyBlock) { - noTabListTime = System.currentTimeMillis() - } + noTabListTime = SimpleTimeMark.now() } @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.inSkyBlock) return - if (noTabListTime == -1L) return + if (noTabListTime == SimpleTimeMark.farPast()) return - if (System.currentTimeMillis() > noTabListTime + 3_000) { - noTabListTime = System.currentTimeMillis() + if (noTabListTime.passedSince() > 3.seconds) { + noTabListTime = SimpleTimeMark.now() ChatUtils.chat( "Extra Information from Tab list not found! " + "Enable it: SkyBlock Menu ➜ Settings ➜ Personal ➜ User Interface ➜ Player List Info" @@ -126,7 +90,7 @@ object ProfileStorageData { sackProfile: SackData.PlayerSpecific, profileName: String, ) { - noTabListTime = -1 + noTabListTime = SimpleTimeMark.farPast() profileSpecific = playerSpecific.profiles.getOrPut(profileName) { Storage.ProfileSpecific() } sackProfiles = sackProfile.profiles.getOrPut(profileName) { SackData.ProfileSpecific() } loaded = true diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt index 6b904bc37..a60fe10d4 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.moulberry.moulconfig.internal.TextRenderUtils @@ -53,7 +53,7 @@ class TitleManager { } @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { endTime = SimpleTimeMark.farPast() } diff --git a/src/main/java/at/hannibal2/skyhanni/events/PreProfileSwitchEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PreProfileSwitchEvent.kt deleted file mode 100644 index 240f14758..000000000 --- a/src/main/java/at/hannibal2/skyhanni/events/PreProfileSwitchEvent.kt +++ /dev/null @@ -1,3 +0,0 @@ -package at.hannibal2.skyhanni.events - -class PreProfileSwitchEvent : LorenzEvent()
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt index 2839797f6..19c3f578e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.event.winter import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName @@ -39,7 +39,7 @@ class JyrreTimer { } @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { resetDisplay() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 46cd544a1..bbecb3d55 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.data.GardenCropUpgrades.Companion.getUpgradeLevel import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.CropType.Companion.getTurboCrop import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon @@ -93,7 +93,7 @@ object FarmingFortuneDisplay { var greenThumbFortune = 0.0 @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() accessoryProgressDisplay = "" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt index f4e48b626..c42afe36c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI @@ -58,7 +58,7 @@ object ArmorDropTracker { } @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { hasArmor = false } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 771c1df2a..c7d15b683 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.config.features.garden.MoneyPerHourConfig.CustomFor import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.isBazaarItem import at.hannibal2.skyhanni.features.bazaar.BazaarData @@ -59,7 +59,7 @@ object CropMoneyDisplay { private val toolHasBountiful get() = GardenAPI.storage?.toolWithBountiful @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index a5fd423fb..190a9b14c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed @@ -52,7 +52,7 @@ class FarmingWeightDisplay { } @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() profileId = "" weight = -2.0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt index 8232f5fc8..2da5a21eb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.data.jsonobjects.repo.DicerDropsJson import at.hannibal2.skyhanni.data.jsonobjects.repo.DicerDropsJson.DicerType import at.hannibal2.skyhanni.events.CropClickEvent import at.hannibal2.skyhanni.events.GardenToolChangeEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI @@ -54,7 +54,7 @@ object GardenCropSpeed { } @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { lastBrokenCrop = null } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index c34fcf433..1274bf2e8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -7,7 +7,7 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.test.command.ErrorManager @@ -79,7 +79,7 @@ object GardenVisitorDropStatistics { } @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 4b659e9bf..90d31bc61 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.SackDataUpdateEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptedEvent @@ -100,7 +100,7 @@ class GardenVisitorFeatures { private var lastFullPrice = 0.0 @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { display = emptyList() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index 6d82115a6..c631165d3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.CropClickEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorArrivalEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.test.command.ErrorManager @@ -80,7 +80,7 @@ class GardenVisitorTimer { } @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { display = "" lastMillis = 0.seconds sixthVisitorArrivalTime = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt index 78cf473ca..304da0d75 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.PacketEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorOpenEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorRenderEvent @@ -50,7 +50,7 @@ class VisitorListener { } @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { VisitorAPI.reset() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index fbb606229..a5a9c8900 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent -import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils @@ -78,7 +78,7 @@ class NonGodPotEffectDisplay { private var totalEffectsCount = 0 @SubscribeEvent - fun onPreProfileSwitch(event: PreProfileSwitchEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { effectDuration.clear() display = emptyList() } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt index 7f19388d4..df127baa6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt @@ -77,4 +77,9 @@ object UtilsPatterns { "skyblocktime.season", "(?:Early |Late )?(?<season>Spring|Summer|Autumn|Winter)" ) + + val tabListProfilePattern by patternGroup.pattern( + "tablist.profile", + "§.§lProfile: §r§a(?<profile>.*)" + ) } |