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 | |
parent | 7cc3c3f786cc993612a56a3f58110936a9efb4d8 (diff) | |
download | skyhanni-4f116e2c8b5e5f28054a73e2e89dbb6746f4f597.tar.gz skyhanni-4f116e2c8b5e5f28054a73e2e89dbb6746f4f597.tar.bz2 skyhanni-4f116e2c8b5e5f28054a73e2e89dbb6746f4f597.zip |
code cleanup
Diffstat (limited to 'src')
3 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index c6cc6ef71..bb9855949 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -250,7 +250,6 @@ import at.hannibal2.skyhanni.features.nether.ashfang.AshfangHideParticles import at.hannibal2.skyhanni.features.nether.ashfang.AshfangNextResetCooldown import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper import at.hannibal2.skyhanni.features.rift.RiftAPI -import at.hannibal2.skyhanni.features.rift.area.wyldwoods.RiftLarva import at.hannibal2.skyhanni.features.rift.area.colosseum.BlobbercystsHighlight import at.hannibal2.skyhanni.features.rift.area.dreadfarm.RiftAgaricusCap import at.hannibal2.skyhanni.features.rift.area.dreadfarm.RiftWiltedBerberisHelper @@ -264,6 +263,7 @@ import at.hannibal2.skyhanni.features.rift.area.mirrorverse.RiftUpsideDownParkou import at.hannibal2.skyhanni.features.rift.area.mirrorverse.TubulatorParkour import at.hannibal2.skyhanni.features.rift.area.stillgorechateau.RiftBloodEffigies import at.hannibal2.skyhanni.features.rift.area.westvillage.KloonHacking +import at.hannibal2.skyhanni.features.rift.area.wyldwoods.RiftLarva import at.hannibal2.skyhanni.features.rift.area.wyldwoods.RiftOdonata import at.hannibal2.skyhanni.features.rift.area.wyldwoods.ShyCruxWarnings import at.hannibal2.skyhanni.features.rift.everywhere.CruxTalismanDisplay @@ -705,7 +705,7 @@ class SkyHanniMod { } val modules: MutableList<Any> = ArrayList() - val globalJob: Job = Job(null) + private val globalJob: Job = Job(null) val coroutineScope = CoroutineScope( CoroutineName("SkyHanni") + SupervisorJob(globalJob) ) 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) diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index d88f9b67a..c7461dc24 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -149,7 +149,7 @@ class SkyHanniDebugsAndTests { // saving old config state SkyHanniMod.configManager.saveConfig(ConfigFileType.FEATURES, "reload config manager") - SkyHanniMod.configManager.saveConfig(ConfigFileType.SACKS,"reload config manager") + SkyHanniMod.configManager.saveConfig(ConfigFileType.SACKS, "reload config manager") Thread { Thread.sleep(500) SkyHanniMod.configManager.disableSaving() |