mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
switch to mariadb
This commit is contained in:
parent
6a0aa89410
commit
ebd86d8ec7
6
pom.xml
6
pom.xml
@ -58,6 +58,12 @@
|
|||||||
<version>3.3.0</version>
|
<version>3.3.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mariadb.jdbc</groupId>
|
||||||
|
<artifactId>mariadb-java-client</artifactId>
|
||||||
|
<version>2.6.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -21,7 +21,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
@Setter
|
@Setter
|
||||||
public class Plex extends JavaPlugin
|
public class Plex extends JavaPlugin
|
||||||
{
|
{
|
||||||
public static Plex plugin;
|
private static Plex plugin;
|
||||||
public MainConfig config;
|
public MainConfig config;
|
||||||
private StorageType storageType = StorageType.SQLITE;
|
private StorageType storageType = StorageType.SQLITE;
|
||||||
|
|
||||||
|
@ -2,5 +2,5 @@ package me.totalfreedom.plex;
|
|||||||
|
|
||||||
public class PlexBase
|
public class PlexBase
|
||||||
{
|
{
|
||||||
protected static Plex plugin = Plex.plugin;
|
protected static Plex plugin = Plex.get();
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,15 @@ package me.totalfreedom.plex.cache;
|
|||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import me.totalfreedom.plex.Plex;
|
||||||
|
import me.totalfreedom.plex.player.PlexPlayer;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import me.totalfreedom.plex.Plex;
|
|
||||||
import me.totalfreedom.plex.player.PlexPlayer;
|
|
||||||
import me.totalfreedom.plex.rank.enums.Rank;
|
|
||||||
|
|
||||||
public class SQLPlayerData
|
public class SQLPlayerData
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,6 @@ public class SQLConnection extends PlexBase
|
|||||||
String username = plugin.config.getString("data.central.user");
|
String username = plugin.config.getString("data.central.user");
|
||||||
String password = plugin.config.getString("data.central.password");
|
String password = plugin.config.getString("data.central.password");
|
||||||
String database = plugin.config.getString("data.central.db");
|
String database = plugin.config.getString("data.central.db");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (plugin.config.getString("data.central.storage").equalsIgnoreCase("sqlite"))
|
if (plugin.config.getString("data.central.storage").equalsIgnoreCase("sqlite"))
|
||||||
@ -26,13 +25,14 @@ public class SQLConnection extends PlexBase
|
|||||||
connection = DriverManager.getConnection("jdbc:sqlite:" + new File(plugin.getDataFolder(), "database.db").getAbsolutePath());
|
connection = DriverManager.getConnection("jdbc:sqlite:" + new File(plugin.getDataFolder(), "database.db").getAbsolutePath());
|
||||||
plugin.setStorageType(StorageType.SQLITE);
|
plugin.setStorageType(StorageType.SQLITE);
|
||||||
}
|
}
|
||||||
else if (plugin.config.getString("data.central.storage").equalsIgnoreCase("mysql"))
|
else if (plugin.config.getString("data.central.storage").equalsIgnoreCase("mariadb"))
|
||||||
{
|
{
|
||||||
connection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password);
|
Class.forName("org.mariadb.jdbc.Driver");
|
||||||
|
connection = DriverManager.getConnection("jdbc:mariadb://" + host + ":" + port + "/" + database, username, password);
|
||||||
Plex.get().setStorageType(StorageType.SQL);
|
Plex.get().setStorageType(StorageType.SQL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException throwables)
|
catch (SQLException | ClassNotFoundException throwables)
|
||||||
{
|
{
|
||||||
throwables.printStackTrace();
|
throwables.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ server:
|
|||||||
|
|
||||||
data:
|
data:
|
||||||
central:
|
central:
|
||||||
storage: sqlite
|
storage: sqlite # use mariadb, mongodb, or sqlite here
|
||||||
user: ""
|
user: ""
|
||||||
password: ""
|
password: ""
|
||||||
hostname: 127.0.0.1
|
hostname: 127.0.0.1
|
||||||
|
Loading…
Reference in New Issue
Block a user