Updated to use hikari
This commit is contained in:
@@ -16,7 +16,9 @@ dependencies {
|
||||
compileOnly 'com.github.TechFortress:GriefPrevention:16.17.1'
|
||||
compileOnly 'com.massivecraft:Factions:1.6.9.5-U0.5.10'
|
||||
compileOnly 'com.github.cryptomorin:kingdoms:1.11.9'
|
||||
compileOnly 'com.github.TownyAdvanced:Towny:0.97.2.6'
|
||||
compileOnly('com.github.TownyAdvanced:Towny:0.97.2.6') {
|
||||
exclude group: 'com.zaxxer', module: 'HikariCP'
|
||||
}
|
||||
compileOnly 'com.github.angeschossen:LandsAPI:5.15.2'
|
||||
compileOnly 'fr.neatmonster:nocheatplus:3.16.1-SNAPSHOT'
|
||||
compileOnly 'com.github.jiangdashao:matrix-api-repo:317d4635fd'
|
||||
@@ -30,6 +32,7 @@ dependencies {
|
||||
compileOnly 'org.jetbrains.exposed:exposed-dao:0.36.2'
|
||||
compileOnly 'org.jetbrains.exposed:exposed-jdbc:0.36.2'
|
||||
compileOnly 'mysql:mysql-connector-java:8.0.25'
|
||||
compileOnly 'com.zaxxer:HikariCP:5.0.0'
|
||||
compileOnly 'com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.0'
|
||||
compileOnly 'com.github.EssentialsX:Essentials:2.19.0'
|
||||
compileOnly 'com.bgsoftware:SuperiorSkyblockAPI:latest'
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.willfp.eco.core.data.PlayerProfile
|
||||
import com.willfp.eco.core.data.keys.PersistentDataKey
|
||||
import com.willfp.eco.core.data.keys.PersistentDataKeyType
|
||||
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
|
||||
import com.zaxxer.hikari.HikariConfig
|
||||
import com.zaxxer.hikari.HikariDataSource
|
||||
import org.apache.logging.log4j.Level
|
||||
import org.bukkit.NamespacedKey
|
||||
import org.jetbrains.exposed.dao.id.UUIDTable
|
||||
@@ -35,15 +37,18 @@ class MySQLDataHandler(
|
||||
private val executor = Executors.newFixedThreadPool(plugin.configYml.getInt("mysql.threads"), threadFactory)
|
||||
|
||||
init {
|
||||
Database.connect(
|
||||
"jdbc:mysql://" +
|
||||
"${plugin.configYml.getString("mysql.host")}:" +
|
||||
"${plugin.configYml.getString("mysql.port")}/" +
|
||||
plugin.configYml.getString("mysql.database"),
|
||||
driver = "com.mysql.cj.jdbc.Driver",
|
||||
user = plugin.configYml.getString("mysql.user"),
|
||||
password = plugin.configYml.getString("mysql.password")
|
||||
)
|
||||
val config = HikariConfig()
|
||||
config.driverClassName = "com.mysql.cj.jdbc.Driver"
|
||||
config.username = plugin.configYml.getString("mysql.user")
|
||||
config.password = plugin.configYml.getString("mysql.password")
|
||||
config.jdbcUrl = "jdbc:mysql://" +
|
||||
"${plugin.configYml.getString("mysql.host")}:" +
|
||||
"${plugin.configYml.getString("mysql.port")}/" +
|
||||
plugin.configYml.getString("mysql.database")
|
||||
config.maximumPoolSize = plugin.configYml.getInt("mysql.connections")
|
||||
|
||||
Database.connect(HikariDataSource(config))
|
||||
|
||||
|
||||
transaction {
|
||||
SchemaUtils.create(Players)
|
||||
|
||||
@@ -9,6 +9,8 @@ mysql:
|
||||
# very high numbers can cause issues with OS configuration. If writes are taking
|
||||
# too long, increase this value.
|
||||
threads: 2
|
||||
# The maximum number of MySQL connections.
|
||||
connections: 10
|
||||
# If read operations should be ran in the thread pool. Runs on main thread by default.
|
||||
async-reads: false
|
||||
host: localhost
|
||||
|
||||
Reference in New Issue
Block a user