diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-17 23:48:45 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-17 23:48:45 +0100 |
commit | 4f116e2c8b5e5f28054a73e2e89dbb6746f4f597 (patch) | |
tree | 954b5a339e21c8876a6f8c3ead33afac7f15a6e3 /src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt | |
parent | 7cc3c3f786cc993612a56a3f58110936a9efb4d8 (diff) | |
download | skyhanni-4f116e2c8b5e5f28054a73e2e89dbb6746f4f597.tar.gz skyhanni-4f116e2c8b5e5f28054a73e2e89dbb6746f4f597.tar.bz2 skyhanni-4f116e2c8b5e5f28054a73e2e89dbb6746f4f597.zip |
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt index 224522c06..0f44a9107 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt @@ -21,14 +21,13 @@ object FriendAPI { private val addedFriendPattern = "§aYou are now friends with (?<name>.*)".toPattern() private val noBestFriendPattern = ".*\n§r(?<name>.*)§e is no longer a best friend!§r§9§m\n.*".toPattern() private val bestFriendPattern = ".*\n(?<name>.*)§a is now a best friend!§r§9§m\n.*".toPattern() + private val readFriendListPattern = "/viewprofile (?<uuid>.*)".toPattern() private val tempFriends = mutableListOf<Friend>() - private fun getFriends(): MutableMap<UUID, Friend> { - return SkyHanniMod.friendsData.players.getOrPut(LorenzUtils.getRawPlayerUuid()) { - FriendsJson.PlayerFriends().also { it.friends = mutableMapOf() } - }.friends - } + private fun getFriends() = SkyHanniMod.friendsData.players.getOrPut(LorenzUtils.getRawPlayerUuid()) { + FriendsJson.PlayerFriends().also { it.friends = mutableMapOf() } + }.friends @SubscribeEvent fun onHypixelJoin(event: HypixelJoinEvent) { @@ -97,7 +96,7 @@ object FriendAPI { val value = chatStyle.chatClickEvent?.value ?: continue if (!value.startsWith("/viewprofile")) continue - val uuid = "/viewprofile (?<uuid>.*)".toPattern().matchMatcher(value) { + val uuid = readFriendListPattern.matchMatcher(value) { group("uuid")?.let { try { UUID.fromString(it) |