Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Load database drivers manually (fixes errors on Velocity and Waterfall)
Browse files Browse the repository at this point in the history
  • Loading branch information
xxneox committed Dec 6, 2021
1 parent 0d372f7 commit 8b165e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ public Database(@NotNull EpicGuard core) {
}

// Initial connection to the database, obtaining HikariDataSource.
public void connect() throws SQLException {
public void connect() throws SQLException, ClassNotFoundException {
var config = this.core.config().storage();
var hikariConfig = new HikariConfig();

if (config.useMySQL()) {
Class.forName("com.mysql.cj.jdbc.Driver"); // Driver is not loaded on Velocity

hikariConfig.setJdbcUrl("jdbc:mysql://" + config.host() + ":" + config.port() + "/" + config.database());
hikariConfig.setUsername(config.user());
hikariConfig.setPassword(config.password());
Expand All @@ -35,6 +37,8 @@ public void connect() throws SQLException {
hikariConfig.addDataSourceProperty("useServerPrepStmts", true);
} else {
var file = FileUtils.create(new File(FileUtils.EPICGUARD_DIR, "database.db"));

Class.forName("org.sqlite.JDBC"); // Driver is not loaded on Waterfall/Velocity
hikariConfig.setJdbcUrl("jdbc:sqlite:" + file.getPath());
}

Expand Down
2 changes: 1 addition & 1 deletion jitpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Also the default build command is broken...
before_install:
- wget https://github.com/sormuras/bach/raw/master/install-jdk.sh
- source install-jdk.sh --feature 16
- source install-jdk.sh --feature 17

install:
- chmod +x gradlew
Expand Down
2 changes: 1 addition & 1 deletion waterfall/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
dependencies {
implementation(project(":core"))

implementation("net.kyori:adventure-platform-bungeecord:4.0.0")
implementation("net.kyori:adventure-platform-bungeecord:4.0.1")
compileOnly("io.github.waterfallmc:waterfall-api:1.17-R0.1-SNAPSHOT")
}

Expand Down

0 comments on commit 8b165e7

Please sign in to comment.