mirror of
https://github.com/Artillex-Studios/AxMinions.git
synced 2024-11-26 12:15:57 +01:00
Fix libraries
This commit is contained in:
parent
d2b3defbd6
commit
d1bf889107
@ -76,6 +76,8 @@ allprojects {
|
||||
|
||||
shadowJar {
|
||||
relocate("com.artillexstudios.axapi", "com.artillexstudios.axminions.libs.axapi")
|
||||
relocate("org.h2", "com.artillexstudios.axminions.libs.h2")
|
||||
relocate("org.jetbrains.kotlin", "com.artillexstudios.axminions.libs.kotlin")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ class AxMinionsPlugin : AxPlugin() {
|
||||
|
||||
init {
|
||||
val manager = BukkitLibraryManager(this)
|
||||
val stdLib = Library.builder().groupId("org.jetbrains.kotlin").artifactId("kotlin-stdlib").relocate("org.jetbrains.kotlin", "com.artillexstudios.axminions.libs.kotlin").version("1.9.0").build()
|
||||
val h2 = Library.builder().groupId("com.h2database").artifactId("h2").version("2.2.220").relocate("org.h2", "com.artillexstudios.axminions.libs.h2").build()
|
||||
val stdLib = Library.builder().groupId("org{}jetbrains{}kotlin").artifactId("kotlin-stdlib").version("1.9.0").relocate("org{}jetbrains{}kotlin", "com{}artillexstudios{}axminions{}libs{}kotlin").build()
|
||||
val h2 = Library.builder().groupId("com{}h2database").artifactId("h2").version("2.2.220").relocate("org{}h2", "com{}artillexstudios{}axminions{}libs{}h2").build()
|
||||
manager.addMavenCentral()
|
||||
manager.loadLibrary(stdLib)
|
||||
manager.loadLibrary(h2)
|
||||
@ -80,6 +80,10 @@ class AxMinionsPlugin : AxPlugin() {
|
||||
MinionTicker.startTicking()
|
||||
}
|
||||
|
||||
override fun disable() {
|
||||
dataHandler.disable()
|
||||
}
|
||||
|
||||
private fun loadDataHandler() {
|
||||
if (Config.DATABASE_TYPE().equals("H2", true)) {
|
||||
dataHandler = H2DataHandler()
|
||||
|
@ -11,14 +11,13 @@ import org.bukkit.Material
|
||||
import org.bukkit.World
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.h2.jdbc.JdbcConnection
|
||||
import java.sql.Connection
|
||||
import java.sql.Statement
|
||||
import java.sql.Types
|
||||
import java.util.Properties
|
||||
import java.util.UUID
|
||||
|
||||
class H2DataHandler : DataHandler {
|
||||
private lateinit var connection: Connection
|
||||
private lateinit var connection: JdbcConnection
|
||||
|
||||
override fun getType(): String {
|
||||
return "H2"
|
||||
@ -219,11 +218,13 @@ class H2DataHandler : DataHandler {
|
||||
}
|
||||
|
||||
if (userId == null) {
|
||||
println("Userid null")
|
||||
return
|
||||
}
|
||||
|
||||
connection.prepareStatement("MERGE INTO `axminions_minions`(`location_id`, `chest_location_id`, `owner_id`, `type_id`, `direction`, `level`, `storage`, `actions`, `tool`) KEY(`location_id`) VALUES(?,?,?,?,?,?,?,?,?)")
|
||||
.use { statement ->
|
||||
println("aaaa")
|
||||
statement.setInt(1, locationId)
|
||||
if (linkedChestId == null) {
|
||||
statement.setNull(2, Types.INTEGER)
|
||||
@ -308,6 +309,6 @@ class H2DataHandler : DataHandler {
|
||||
}
|
||||
|
||||
override fun disable() {
|
||||
connection.close()
|
||||
connection.prepareStatement("SHUTDOWN DEFRAG;").executeUpdate()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user