aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/LedgerLogger.kt
blob: 4692a1320d544d1c4bc3679d2a04410c137c63a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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,
)