mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-19 14:59:20 +00:00
Fixed issues with MariaDB support and renamed MariaDB to MySQL
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"mainClass": "org.geysermc.floodgate.database.MariadbDatabase",
|
||||
"config": "mariadb.yml"
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mariadb</artifactId>
|
||||
<artifactId>mysql</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -39,21 +39,21 @@ import java.util.concurrent.CompletionException;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.floodgate.api.link.LinkRequest;
|
||||
import org.geysermc.floodgate.api.link.LinkRequestResult;
|
||||
import org.geysermc.floodgate.database.config.MariadbConfig;
|
||||
import org.geysermc.floodgate.database.config.MysqlConfig;
|
||||
import org.geysermc.floodgate.link.CommonPlayerLink;
|
||||
import org.geysermc.floodgate.link.LinkRequestImpl;
|
||||
import org.geysermc.floodgate.util.LinkedPlayer;
|
||||
import org.mariadb.jdbc.MariaDbPoolDataSource;
|
||||
|
||||
public class MariadbDatabase extends CommonPlayerLink {
|
||||
public class MysqlDatabase extends CommonPlayerLink {
|
||||
private MariaDbPoolDataSource pool;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
getLogger().info("Connecting to mariadb database...");
|
||||
getLogger().info("Connecting to a MySQL-like database...");
|
||||
try {
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
MariadbConfig databaseconfig = getConfig(MariadbConfig.class);
|
||||
MysqlConfig databaseconfig = getConfig(MysqlConfig.class);
|
||||
pool = new MariaDbPoolDataSource(
|
||||
"jdbc:mariadb://" + databaseconfig.getHostname() + "/" +
|
||||
databaseconfig.getDatabase() +
|
||||
@@ -85,9 +85,9 @@ public class MariadbDatabase extends CommonPlayerLink {
|
||||
);
|
||||
}
|
||||
}
|
||||
getLogger().info("Connected to mariadb database.");
|
||||
getLogger().info("Connected to MySQL-like database.");
|
||||
} catch (ClassNotFoundException exception) {
|
||||
getLogger().error("The required class to load the MariaDB database wasn't found");
|
||||
getLogger().error("The required class to load the MySQL database wasn't found");
|
||||
} catch (SQLException exception) {
|
||||
getLogger().error("Error while loading database", exception);
|
||||
}
|
||||
@@ -28,7 +28,7 @@ package org.geysermc.floodgate.database.config;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class MariadbConfig implements DatabaseConfig {
|
||||
public class MysqlConfig implements DatabaseConfig {
|
||||
private String hostname = "localhost";
|
||||
private String database = "floodgate";
|
||||
private String username = "floodgate";
|
||||
4
database/mysql/src/main/resources/init.json
Normal file
4
database/mysql/src/main/resources/init.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"mainClass": "org.geysermc.floodgate.database.MysqlDatabase",
|
||||
"config": "mysql.yml"
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<modules>
|
||||
<module>sqlite</module>
|
||||
<module>mariadb</module>
|
||||
<module>mysql</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
||||
Reference in New Issue
Block a user