diff options
author | Linnea Gräf <nea@nea.moe> | 2025-01-30 20:11:37 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-01-30 20:11:37 +0100 |
commit | 8e386bcf8d10784fc7784333be9e4470598c71d4 (patch) | |
tree | f0bd83c41bd083b6708703d420fe466b5f66111a /mod/src/main/kotlin/moe/nea/ledger/events/LedgerEvent.kt | |
parent | e51a59636129c35b58dbdda83b141b539a87e6fe (diff) | |
download | LocalTransactionLedger-8e386bcf8d10784fc7784333be9e4470598c71d4.tar.gz LocalTransactionLedger-8e386bcf8d10784fc7784333be9e4470598c71d4.tar.bz2 LocalTransactionLedger-8e386bcf8d10784fc7784333be9e4470598c71d4.zip |
Diffstat (limited to 'mod/src/main/kotlin/moe/nea/ledger/events/LedgerEvent.kt')
-rw-r--r-- | mod/src/main/kotlin/moe/nea/ledger/events/LedgerEvent.kt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/LedgerEvent.kt b/mod/src/main/kotlin/moe/nea/ledger/events/LedgerEvent.kt new file mode 100644 index 0000000..cbb3f81 --- /dev/null +++ b/mod/src/main/kotlin/moe/nea/ledger/events/LedgerEvent.kt @@ -0,0 +1,22 @@ +package moe.nea.ledger.events + +import moe.nea.ledger.Ledger +import moe.nea.ledger.utils.ErrorUtil +import moe.nea.ledger.utils.telemetry.CommonKeys +import moe.nea.ledger.utils.telemetry.ContextValue +import net.minecraftforge.common.MinecraftForge +import net.minecraftforge.fml.common.eventhandler.Event + +abstract class LedgerEvent : Event(), ContextValue { + fun post() { + Ledger.leakDI() + .provide<ErrorUtil>() + .catch( + CommonKeys.EVENT_MESSAGE to ContextValue.string("Error during event execution"), + "event_instance" to this, + "event_type" to ContextValue.string(javaClass.name) + ) { + MinecraftForge.EVENT_BUS.post(this) + } + } +}
\ No newline at end of file |