mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 14:38:53 +00:00
Adjust SQLite initialization to use jdbc properties, change runtime library downloading to use libby
This commit is contained in:
1 parent
8a7bb11c10
commit
2112b0f5e0
10 files changed
+68
-28
No files matched your search
+8
-10
@@ -1,12 +1,13 @@
|
||||
dependencies {
|
||||
compileOnly 'commons-io:commons-io:2.11.0'
|
||||
compileOnly 'dev.dejvokep:boosted-yaml:1.2'
|
||||
compileOnly 'de.themoep:minedown:1.7.1-SNAPSHOT'
|
||||
compileOnly 'redis.clients:jedis:4.2.3'
|
||||
|
||||
implementation 'commons-io:commons-io:2.11.0'
|
||||
implementation 'dev.dejvokep:boosted-yaml:1.2'
|
||||
implementation 'de.themoep:minedown:1.7.1-SNAPSHOT'
|
||||
implementation 'com.zaxxer:HikariCP:5.0.1'
|
||||
implementation 'org.xerial:sqlite-jdbc:3.36.0.3'
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
|
||||
compileOnly 'redis.clients:jedis:' + jedis_version
|
||||
compileOnly 'org.xerial:sqlite-jdbc:' + sqlite_driver_version
|
||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
@@ -17,8 +18,5 @@ shadowJar {
|
||||
relocate 'org.intellij', 'net.william278.huskhomes.libraries'
|
||||
relocate 'com.zaxxer', 'net.william278.huskhomes.libraries'
|
||||
relocate 'org.slf4j', 'net.william278.huskhomes.libraries.slf4j'
|
||||
relocate 'org.xerial', 'net.william278.huskhomes.libraries'
|
||||
relocate 'io.papermc.lib', 'net.william278.huskhomes.libraries.paperlib'
|
||||
relocate 'com.google.code', 'net.william278.huskhomes.libraries'
|
||||
relocate 'redis.clients', 'net.william278.huskhomes.libraries.jedis'
|
||||
relocate 'com.google', 'net.william278.huskhomes.libraries'
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* A cache used to hold persistently used data
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.william278.huskhomes.util.Logger;
|
||||
import net.william278.huskhomes.util.ResourceReader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.sqlite.SQLiteConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -66,11 +67,20 @@ public class SqLiteDatabase extends Database {
|
||||
}
|
||||
|
||||
// Establish the connection using the JDBC SQLite driver
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + databaseFile.getAbsolutePath());
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
|
||||
SQLiteConfig config = new SQLiteConfig();
|
||||
config.enforceForeignKeys(true);
|
||||
config.setEncoding(SQLiteConfig.Encoding.UTF8);
|
||||
config.setSynchronous(SQLiteConfig.SynchronousMode.FULL);
|
||||
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + databaseFile.getAbsolutePath(), config.toProperties());
|
||||
} catch (IOException e) {
|
||||
getLogger().log(Level.SEVERE, "An exception occurred creating the database file", e);
|
||||
} catch (SQLException e) {
|
||||
getLogger().log(Level.SEVERE, "An SQL exception occurred initializing the SQLite database", e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
getLogger().log(Level.SEVERE, "Failed to load the necessary SQLite driver", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
/* Ensure data gets correctly encoded in UTF-8 */
|
||||
PRAGMA encoding = 'UTF-8';
|
||||
|
||||
/* Ensure foreign key constraints are enforced */
|
||||
PRAGMA foreign_keys = ON;
|
||||
|
||||
/* Create the positions table if it does not exist */
|
||||
CREATE TABLE IF NOT EXISTS `%positions_table%`
|
||||
(
|
||||
|
||||
Reference in new issue
Block a user