From 5daefca0b50e563152462f0ee1a963b8c98c33f0 Mon Sep 17 00:00:00 2001 From: jani270 <69345714+jani270@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:53:02 +0100 Subject: feat: Gummy Polar Bear Detection --- .../main/kotlin/moe/nea/ledger/TransactionType.kt | 1 + mod/src/main/kotlin/moe/nea/ledger/Ledger.kt | 2 ++ .../nea/ledger/modules/GummyPolarBearDetection.kt | 34 ++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 mod/src/main/kotlin/moe/nea/ledger/modules/GummyPolarBearDetection.kt diff --git a/basetypes/src/main/kotlin/moe/nea/ledger/TransactionType.kt b/basetypes/src/main/kotlin/moe/nea/ledger/TransactionType.kt index 33c633d..8424893 100644 --- a/basetypes/src/main/kotlin/moe/nea/ledger/TransactionType.kt +++ b/basetypes/src/main/kotlin/moe/nea/ledger/TransactionType.kt @@ -24,6 +24,7 @@ enum class TransactionType { FORGED, GOD_POTION_DRANK, GOD_POTION_MIXIN_DRANK, + GUMMY_POLAR_BEAR_ATE, KAT_TIMESKIP, KAT_UPGRADE, KISMET_REROLL, diff --git a/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt b/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt index 043b83e..e0382a9 100644 --- a/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt +++ b/mod/src/main/kotlin/moe/nea/ledger/Ledger.kt @@ -29,6 +29,7 @@ import moe.nea.ledger.modules.ForgeDetection import moe.nea.ledger.modules.GambleDetection import moe.nea.ledger.modules.GodPotionDetection import moe.nea.ledger.modules.GodPotionMixinDetection +import moe.nea.ledger.modules.GummyPolarBearDetection import moe.nea.ledger.modules.KatDetection import moe.nea.ledger.modules.KuudraChestDetection import moe.nea.ledger.modules.MineshaftCorpseDetection @@ -141,6 +142,7 @@ class Ledger { GambleDetection::class.java, GodPotionDetection::class.java, GodPotionMixinDetection::class.java, + GummyPolarBearDetection::class.java, ItemIdProvider::class.java, KatDetection::class.java, KuudraChestDetection::class.java, diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/GummyPolarBearDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/GummyPolarBearDetection.kt new file mode 100644 index 0000000..d69df83 --- /dev/null +++ b/mod/src/main/kotlin/moe/nea/ledger/modules/GummyPolarBearDetection.kt @@ -0,0 +1,34 @@ +package moe.nea.ledger.modules + +import moe.nea.ledger.ItemChange +import moe.nea.ledger.LedgerEntry +import moe.nea.ledger.LedgerLogger +import moe.nea.ledger.TransactionType +import moe.nea.ledger.events.ChatReceived +import moe.nea.ledger.gen.ItemIds +import moe.nea.ledger.useMatcher +import moe.nea.ledger.utils.di.Inject +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class GummyPolarBearDetection { + + val ateGummyPolarBear = "You ate a Re-heated Gummy Polar Bear!".toPattern() + + @Inject + lateinit var logger: LedgerLogger + + @SubscribeEvent + fun onChat(event: ChatReceived) { + ateGummyPolarBear.useMatcher(event.message) { + logger.logEntry( + LedgerEntry( + TransactionType.GUMMY_POLAR_BEAR_ATE, + event.timestamp, + listOf( + ItemChange.lose(ItemIds.REHEATED_GUMMY_POLAR_BEAR, 1) + ) + ) + ) + } + } +} \ No newline at end of file -- cgit