9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2026-01-03 14:22:17 +00:00

Why am I pushing this to master?

This commit is contained in:
Auxilor
2021-09-20 13:07:32 +01:00
parent ea59ee4bf7
commit 41eede94c9
5 changed files with 63 additions and 31 deletions

View File

@@ -10,6 +10,7 @@ dependencies {
compileOnly 'org.jetbrains.exposed:exposed-core:0.34.1'
compileOnly 'org.jetbrains.exposed:exposed-dao:0.34.1'
compileOnly 'org.jetbrains.exposed:exposed-jdbc:0.34.1'
compileOnly 'mysql:mysql-connector-java:5.1.48'
}
build.dependsOn publishToMavenLocal

View File

@@ -0,0 +1,59 @@
package com.willfp.ecoskills.data.storage
import com.willfp.ecoskills.EcoSkillsPlugin
import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.SchemaUtils
import org.jetbrains.exposed.sql.Table
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.transactions.transaction
import java.util.*
@Suppress("UNCHECKED_CAST")
class MySQLDataHandler(
private val plugin: EcoSkillsPlugin
) : DataHandler {
init {
Database.connect(
"jdbc:mysql://" +
"${plugin.configYml.getString("mysql.host")}:" +
"${plugin.configYml.getString("mysql.port")}/" +
plugin.configYml.getString("mysql.database"),
driver = "com.mysql.jdbc.Driver",
user = plugin.configYml.getString("mysql.user"),
password = plugin.configYml.getString("mysql.password")
)
transaction {
SchemaUtils.create(Players)
}
}
override fun save() {
TODO()
}
override fun <T> write(uuid: UUID, key: String, value: T) {
transaction {
Players.insert {
it[id] = id.toString()
}
}
TODO()
}
override fun readInt(uuid: UUID, key: String): Int {
TODO()
}
override fun readDouble(uuid: UUID, key: String): Double {
TODO()
}
override fun readString(uuid: UUID, key: String, default: String): String {
TODO()
}
object Players: Table() {
val id = varchar("uuid", 36)
}
}

View File

@@ -1,29 +0,0 @@
package com.willfp.ecoskills.data.storage
import com.willfp.ecoskills.EcoSkillsPlugin
import java.util.*
@Suppress("UNCHECKED_CAST")
class SQLDataHandler(
private val plugin: EcoSkillsPlugin
) : DataHandler {
override fun save() {
TODO()
}
override fun <T> write(uuid: UUID, key: String, value: T) {
TODO()
}
override fun readInt(uuid: UUID, key: String): Int {
TODO()
}
override fun readDouble(uuid: UUID, key: String): Double {
TODO()
}
override fun readString(uuid: UUID, key: String, default: String): String {
TODO()
}
}

View File

@@ -3,8 +3,8 @@
# by Auxilor
#
database:
use-db: false # If database storage should be used. Set to false, data.yml will be used instead.
mysql:
enabled: false # Set to false, data.yml will be used instead.
host: localhost
port: 3306
database: db

View File

@@ -16,6 +16,7 @@ libraries:
- 'org.jetbrains.exposed:exposed-core:0.34.1'
- 'org.jetbrains.exposed:exposed-dao:0.34.1'
- 'org.jetbrains.exposed:exposed-jdbc:0.34.1'
- 'mysql:mysql-connector-java:5.1.48'
commands:
ecoskills: