aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/LedgerLogger.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-02-15 18:05:28 +0100
committerLinnea Gräf <nea@nea.moe>2024-02-15 18:05:28 +0100
commitee5d205578117d6fab9b2f89871e5442e480644f (patch)
tree60753f880972e85e39ed9c1e98bb534253cbd535 /src/main/kotlin/moe/nea/ledger/LedgerLogger.kt
downloadLocalTransactionLedger-ee5d205578117d6fab9b2f89871e5442e480644f.tar.gz
LocalTransactionLedger-ee5d205578117d6fab9b2f89871e5442e480644f.tar.bz2
LocalTransactionLedger-ee5d205578117d6fab9b2f89871e5442e480644f.zip
Initial commit
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/LedgerLogger.kt')
-rw-r--r--src/main/kotlin/moe/nea/ledger/LedgerLogger.kt34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/LedgerLogger.kt b/src/main/kotlin/moe/nea/ledger/LedgerLogger.kt
new file mode 100644
index 0000000..4692a13
--- /dev/null
+++ b/src/main/kotlin/moe/nea/ledger/LedgerLogger.kt
@@ -0,0 +1,34 @@
+package moe.nea.ledger
+
+import net.minecraft.client.Minecraft
+import net.minecraft.util.ChatComponentText
+import java.time.Instant
+
+class LedgerLogger {
+ fun printOut(text: String) {
+ Minecraft.getMinecraft().ingameGUI?.chatGUI?.printChatMessage(ChatComponentText(text))
+ }
+
+ fun logEntry(entry: LedgerEntry) {
+ printOut(
+ """
+ §e================= TRANSACTION START
+ §eTYPE: §a${entry.transactionType}
+ §eTIMESTAMP: §a${entry.timestamp}
+ §eTOTAL VALUE: §a${entry.totalTransactionCoins}
+ §eITEM ID: §a${entry.itemId}
+ §eITEM AMOUNT: §a${entry.itemAmount}
+ §e================= TRANSACTION END
+ """.trimIndent()
+ )
+ }
+
+}
+
+data class LedgerEntry(
+ val transactionType: String,
+ val timestamp: Instant,
+ val totalTransactionCoins: Double,
+ val itemId: String? = null,
+ val itemAmount: Int? = null,
+)