aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger')
-rw-r--r--src/main/kotlin/moe/nea/ledger/Ledger.kt5
-rw-r--r--src/main/kotlin/moe/nea/ledger/LedgerLogger.kt2
-rw-r--r--src/main/kotlin/moe/nea/ledger/database/Database.kt3
3 files changed, 4 insertions, 6 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/Ledger.kt b/src/main/kotlin/moe/nea/ledger/Ledger.kt
index 784c111..b4fe2c4 100644
--- a/src/main/kotlin/moe/nea/ledger/Ledger.kt
+++ b/src/main/kotlin/moe/nea/ledger/Ledger.kt
@@ -3,11 +3,7 @@ package moe.nea.ledger
import io.github.notenoughupdates.moulconfig.common.IMinecraft
import io.github.notenoughupdates.moulconfig.managed.ManagedConfig
import moe.nea.ledger.config.LedgerConfig
-import moe.nea.ledger.database.Column
-import moe.nea.ledger.database.DBInstant
-import moe.nea.ledger.database.DBString
import moe.nea.ledger.database.Database
-import moe.nea.ledger.database.Table
import net.minecraft.client.Minecraft
import net.minecraft.command.CommandBase
import net.minecraft.command.ICommandSender
@@ -53,6 +49,7 @@ class Ledger {
TODO: TRADING, FORGE, COOKIE_EATEN, NPC_SELL, NPC_BUY
*/
companion object {
+ val dataFolder = File("money-ledger").apply { mkdirs() }
val logger = LogManager.getLogger("MoneyLedger")
val managedConfig = ManagedConfig.create(File("config/money-ledger/config.json"), LedgerConfig::class.java) {
checkExpose = false
diff --git a/src/main/kotlin/moe/nea/ledger/LedgerLogger.kt b/src/main/kotlin/moe/nea/ledger/LedgerLogger.kt
index 6ac3244..03d306c 100644
--- a/src/main/kotlin/moe/nea/ledger/LedgerLogger.kt
+++ b/src/main/kotlin/moe/nea/ledger/LedgerLogger.kt
@@ -119,7 +119,7 @@ class LedgerLogger {
val gson = Gson()
- val folder = File("money-ledger").also { it.mkdirs() }
+ val folder = Ledger.dataFolder
val file: File = run {
val date = SimpleDateFormat("yyyy.MM.dd").format(Date())
diff --git a/src/main/kotlin/moe/nea/ledger/database/Database.kt b/src/main/kotlin/moe/nea/ledger/database/Database.kt
index 633b3a0..9dc4e00 100644
--- a/src/main/kotlin/moe/nea/ledger/database/Database.kt
+++ b/src/main/kotlin/moe/nea/ledger/database/Database.kt
@@ -1,9 +1,10 @@
package moe.nea.ledger.database
+import moe.nea.ledger.Ledger
import java.sql.DriverManager
object Database {
- val connection = DriverManager.getConnection("jdbc:sqlite:money-ledger/database.db")
+ val connection = DriverManager.getConnection("jdbc:sqlite:${Ledger.dataFolder.resolve("database.db")}")
object MetaTable : Table("LedgerMeta") {
val key = column("key", DBString)