From 31c2e93d5cfd21c8a2a6ce68ea13c7d9256c5af6 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 5 Nov 2023 12:43:02 +0100 Subject: code cleanup --- .../java/at/hannibal2/skyhanni/config/Features.java | 4 ++-- .../at/hannibal2/skyhanni/data/ProfileStorageData.kt | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index ce6e0f1b2..9ae08f094 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -44,8 +44,8 @@ public class Features extends Config { @Override public List getSocials() { return Arrays.asList( - Social.forLink("Join our Discord", DISCORD, "https://discord.com/invite/skyhanni-997079228510117908"), - Social.forLink("Look at the code", GITHUB, "https://github.com/hannibal002/SkyHanni") + Social.forLink("Join our Discord", DISCORD, "https://discord.com/invite/skyhanni-997079228510117908"), + Social.forLink("Look at the code", GITHUB, "https://github.com/hannibal002/SkyHanni") ); } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt index d14372419..a8770e1f2 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt @@ -24,14 +24,15 @@ object ProfileStorageData { private var nextProfile: String? = null + // TODO USE SH-REPO + private val profileSwitchPattern = "§7Switching to profile (?.*)\\.\\.\\.".toPattern() private var sackPlayers: SackData.PlayerSpecific? = null var sackProfiles: SackData.ProfileSpecific? = null @SubscribeEvent(priority = EventPriority.HIGHEST) fun onChat(event: LorenzChatEvent) { - // TODO USE SH-REPO - "§7Switching to profile (?.*)\\.\\.\\.".toPattern().matchMatcher(event.message) { + profileSwitchPattern.matchMatcher(event.message) { nextProfile = group("name").lowercase() loaded = false PreProfileSwitchEvent().postAndCatch() @@ -53,7 +54,7 @@ object ProfileStorageData { LorenzUtils.error("sackPlayers after profile swap can not be set: sackPlayers is null!") return } - loadProfileSpecific(playerSpecific, sackPlayers, profileName, "profile swap (chat message)") + loadProfileSpecific(playerSpecific, sackPlayers, profileName) ConfigLoadEvent().postAndCatch() } @@ -72,7 +73,7 @@ object ProfileStorageData { if (profileSpecific == null) { val profileName = event.name - loadProfileSpecific(playerSpecific, sackPlayers, profileName, "first join (chat message)") + loadProfileSpecific(playerSpecific, sackPlayers, profileName) } } @@ -85,7 +86,7 @@ object ProfileStorageData { val pattern = "§e§lProfile: §r§a(?.*)".toPattern() pattern.matchMatcher(line) { val profileName = group("name").lowercase() - loadProfileSpecific(playerSpecific, sackPlayers, profileName, "tab list") + loadProfileSpecific(playerSpecific, sackPlayers, profileName) nextProfile = null return } @@ -105,12 +106,16 @@ object ProfileStorageData { noTabListTime = System.currentTimeMillis() LorenzUtils.chat( "§c[SkyHanni] Extra Information from Tab list not found! " + - "Enable it: SkyBlock Menu ➜ Settings ➜ Personal ➜ User Interface ➜ Player List Info" + "Enable it: SkyBlock Menu ➜ Settings ➜ Personal ➜ User Interface ➜ Player List Info" ) } } - private fun loadProfileSpecific(playerSpecific: Storage.PlayerSpecific, sackProfile: SackData.PlayerSpecific, profileName: String, reason: String) { + private fun loadProfileSpecific( + playerSpecific: Storage.PlayerSpecific, + sackProfile: SackData.PlayerSpecific, + profileName: String + ) { noTabListTime = -1 profileSpecific = playerSpecific.profiles.getOrPut(profileName) { Storage.ProfileSpecific() } sackProfiles = sackProfile.profiles.getOrPut(profileName) { SackData.ProfileSpecific() } -- cgit