From d48cf0126f9c163dd85c860004f658167912c85c Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 4 Apr 2024 20:18:41 +0200 Subject: code cleanup --- .../skyhanni/features/garden/GardenCropMilestoneFix.kt | 11 ++--------- .../at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt | 2 +- .../skyhanni/features/garden/pests/PestProfitTracker.kt | 11 +---------- 3 files changed, 4 insertions(+), 20 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt index 79461a78a..c4f85ae45 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.farming.GardenCropMilestoneDisplay +import at.hannibal2.skyhanni.features.garden.pests.PestAPI import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.itemNameWithoutColor import at.hannibal2.skyhanni.utils.NEUInternalName @@ -27,14 +28,6 @@ class GardenCropMilestoneFix { "levelup", " {2}§r§b§lGARDEN MILESTONE §3(?.*) §8.*➜§3(?.*)" ) - /** - * REGEX-TEST: §eYou received §a7x Enchanted Potato §efor killing a §6Locust§e! - * REGEX-TEST: §eYou received §a6x Enchanted Cocoa Beans §efor killing a §6Moth§e! - */ - private val pestLootPattern by patternGroup.pattern( - "pests.loot", - "§eYou received §a(?[0-9]*)x (?.*) §efor killing an? §6(?.*)§e!" - ) /** * REGEX-TEST: §6§lRARE DROP! §9Mutant Nether Wart §6(§6+1,344☘) */ @@ -56,7 +49,7 @@ class GardenCropMilestoneFix { val crops = GardenCropMilestones.getCropsForTier(tier, crop) changedValue(crop, crops, "level up chat message", 0) } - pestLootPattern.matchMatcher(event.message) { + PestAPI.pestDeathChatPattern.matchMatcher(event.message) { val amount = group("amount").toInt() val item = NEUInternalName.fromItemNameOrNull(group("item")) ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt index 4a1a626b8..8c218845a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt @@ -94,7 +94,7 @@ object PestAPI { * REGEX-TEST: §eYou received §a7x Enchanted Potato §efor killing a §6Locust§e! * REGEX-TEST: §eYou received §a6x Enchanted Cocoa Beans §efor killing a §6Moth§e! */ - private val pestDeathChatPattern by patternGroup.pattern( + val pestDeathChatPattern by patternGroup.pattern( "chat.pestdeath", "§eYou received §a(?[0-9]*)x (?.*) §efor killing an? §6(?.*)§e!" ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt index c3c768044..401d23733 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt @@ -26,15 +26,6 @@ object PestProfitTracker { private val patternGroup = RepoPattern.group("garden.pests.tracker") - /** - * REGEX-TEST: §eYou received §a7x Enchanted Potato §efor killing a §6Locust§e! - * REGEX-TEST: §eYou received §a6x Enchanted Cocoa Beans §efor killing a §6Moth§e! - */ - private val pestLootPattern by patternGroup.pattern( - "loot", - "§eYou received §a(?[0-9]*)x (?.*) §efor killing an? §6(?.*)§e!" - ) - /** * REGEX-TEST: §6§lRARE DROP! §9Mutant Nether Wart §6(§6+1,344☘) * REGEX-TEST: §6§lPET DROP! §r§5Slug §6(§6+1300☘) @@ -81,7 +72,7 @@ object PestProfitTracker { @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!isEnabled()) return - pestLootPattern.matchMatcher(event.message) { + PestAPI.pestDeathChatPattern.matchMatcher(event.message) { val amount = group("amount").toInt() val internalName = NEUInternalName.fromItemNameOrNull(group("item")) ?: return -- cgit