1. Fix: Change database schema and table names. \n 2. Remove sync_instance_with_server.bat from this project to server project so users do not need access to this project.
This commit is contained in:
@@ -28,17 +28,23 @@ public class DatabaseManager {
|
||||
private static final String DB_PASSWORD = System.getenv("DB_PASSWORD"); // "password";
|
||||
*/
|
||||
/* Public connection */
|
||||
protected static final String DB_URL = "jdbc:mysql://185.221.63.17/partsltd_dev";
|
||||
protected static final String DB_URL = "jdbc:mysql://185.221.63.17/partsltd_minecraft";
|
||||
protected static final String DB_USERNAME = "partsltd_minecraft_mod";
|
||||
protected static final String DB_PASSWORD = "nipples_are_always_erect";
|
||||
protected static final Logger LOGGER = Logger.getLogger(DatabaseManager.class.getName());
|
||||
|
||||
/*
|
||||
public DatabaseManager() {
|
||||
config = new Properties();
|
||||
loadConfig();
|
||||
static {
|
||||
try {
|
||||
// Explicitly load the MySQL driver
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
LOGGER.info("MySQL JDBC Driver registered successfully");
|
||||
} catch (ClassNotFoundException e) {
|
||||
LOGGER.severe("Failed to load MySQL JDBC driver: " + e.getMessage());
|
||||
throw new RuntimeException("Failed to load MySQL JDBC driver", e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
protected void loadConfig() {
|
||||
File configFile = new File("config/playerstats/database.properties");
|
||||
if (!configFile.exists()) {
|
||||
@@ -97,7 +103,7 @@ public class DatabaseManager {
|
||||
public void recordLocation(Player player) {
|
||||
try (Connection conn = getConnection();
|
||||
PreparedStatement stmt = conn.prepareStatement(
|
||||
"INSERT INTO MCMPS_player_locations (player_uuid, x, y, z, dimension, timestamp) VALUES (?, ?, ?, ?, ?, ?)")) {
|
||||
"INSERT INTO MCMPS_player_location (player_uuid, x, y, z, dimension, timestamp) VALUES (?, ?, ?, ?, ?, ?)")) {
|
||||
|
||||
stmt.setString(1, player.getUUID().toString());
|
||||
stmt.setDouble(2, player.getX());
|
||||
@@ -113,6 +119,7 @@ public class DatabaseManager {
|
||||
|
||||
public void initializeDatabase() {
|
||||
try (Connection conn = getConnection()) {
|
||||
/*
|
||||
// Create tables
|
||||
conn.createStatement().execute("""
|
||||
CREATE TABLE IF NOT EXISTS MCMPS_player_statistic (
|
||||
@@ -128,7 +135,7 @@ public class DatabaseManager {
|
||||
""");
|
||||
|
||||
conn.createStatement().execute("""
|
||||
CREATE TABLE IF NOT EXISTS MCMPS_player_locations (
|
||||
CREATE TABLE IF NOT EXISTS MCMPS_player_location (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
player_uuid VARCHAR(36),
|
||||
x DOUBLE,
|
||||
@@ -139,6 +146,7 @@ public class DatabaseManager {
|
||||
INDEX idx_player_uuid (player_uuid)
|
||||
)
|
||||
""");
|
||||
*/
|
||||
LOGGER.log(Level.INFO, "Database initialised");
|
||||
} catch (SQLException e) {
|
||||
LOGGER.log(Level.INFO, "Database initialisation error");
|
||||
|
||||
Reference in New Issue
Block a user