Added config parameter

- made database filename configurable
pull/15/head
Trivernis 5 years ago
parent 3a0012ef3f
commit ce826419f1

@ -64,6 +64,7 @@ class Chunkmaster: JavaPlugin() {
config.addDefault("generation.pause-on-join", true)
config.addDefault("generation.max-pending-chunks", 10)
config.addDefault("generation.max-loaded-chunks", 10)
config.addDefault("database.filename", "chunkmaster.db")
config.options().copyDefaults(true)
saveConfig()
}

@ -33,7 +33,8 @@ class SqliteManager(private val chunkmaster: Chunkmaster) {
fun getConnection(): Connection? {
try {
Class.forName("org.sqlite.JDBC")
return DriverManager.getConnection("jdbc:sqlite:${chunkmaster.dataFolder.absolutePath}/chunkmaster.db")
return DriverManager.getConnection("jdbc:sqlite:${chunkmaster.dataFolder.absolutePath}/" +
"${chunkmaster.config.getString("database.filename")}")
} catch (e: Exception) {
chunkmaster.logger.severe("Could not get database connection.")
chunkmaster.logger.severe(e.message)

Loading…
Cancel
Save