summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/BedrockConnect.java81
-rw-r--r--serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/sql/DatabaseTypes.java2
-rw-r--r--serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/sql/MySQL.java2
4 files changed, 63 insertions, 26 deletions
diff --git a/README.md b/README.md
index f12682b..e097c18 100644
--- a/README.md
+++ b/README.md
@@ -130,6 +130,7 @@ The following is the full list of settings available:
| Setting | Description | Default Value |
|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
+| db_type | Database Type (accepts values *mysql*, *postgres*, *mariadb*, or *none*) | mysql |
| db_host | Database Host | localhost |
| db_db | Database Name | bedrock-connect |
| db_user | Database Username | root |
@@ -138,9 +139,6 @@ The following is the full list of settings available:
| port | Port of the server (Should only be changed for debugging on PC. Port needs to be on 19132 for the bypass to work on game consoles) | 19132 |
| bindip | IP that the BedrockConnect server will bind to | 0.0.0.0 |
| nodb | If true, use JSON files | true |
-| mysql | If true, use Mysql | false |
-| mairadb | If true, use MairaDB | false |
-| postgres | If true, use Postgres | false |
| auto_reconnect | If true, Make Mysql and MairaDB auto reconnect to the database when disconnected | false |
| generatedns | If true, generate a DNS zone file using user input (Only needed if you're using the mod0Umleitung DNS software) | false |
| kick_inactive | If true, players will be kicked after 10 minutes of inactivity with the serverlist UI | true |
diff --git a/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/BedrockConnect.java b/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/BedrockConnect.java
index cd1202b..30a08b2 100644
--- a/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/BedrockConnect.java
+++ b/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/BedrockConnect.java
@@ -46,7 +46,7 @@ public class BedrockConnect {
public static int globalPacketLimit = RakConstants.DEFAULT_GLOBAL_PACKET_LIMIT;
- public static String release = "1.47";
+ public static String release = "1.48";
public static HashMap<String, String> featuredServerIps;
@@ -63,7 +63,7 @@ public class BedrockConnect {
String password = "";
String port = "19132";
String bindIp = "0.0.0.0";
- DatabaseTypes databaseType = DatabaseTypes.nosql;
+ DatabaseTypes databaseType = DatabaseTypes.mysql;
boolean autoReconnect = false;
String serverLimit = "100";
@@ -104,6 +104,9 @@ public class BedrockConnect {
}
} catch(SecurityException e) {}
+ boolean nodbWarning = true;
+ boolean mysqlSettingWarning = false;
+
for (Map.Entry<String, String> setting : settings.entrySet()) {
switch(setting.getKey().toLowerCase()) {
case "db_host":
@@ -118,6 +121,43 @@ public class BedrockConnect {
case "db_pass":
password = setting.getValue();
break;
+ case "db_type":
+ nodbWarning = false;
+ String dbType = setting.getValue().toLowerCase();
+ switch(dbType) {
+ case "none":
+ databaseType = DatabaseTypes.nosql;
+ break;
+ case "mysql":
+ databaseType = DatabaseTypes.mysql;
+ break;
+ case "mariadb":
+ databaseType = DatabaseTypes.mariadb;
+ break;
+ case "postgres":
+ databaseType = DatabaseTypes.postgres;
+ break;
+ }
+ break;
+ // Backwards-compatibility for legacy database/mysql settings
+ // db_ settings above should be used for any future setups/database-related changes
+ case "mysql_host":
+ mysqlSettingWarning = true;
+ hostname = setting.getValue();
+ break;
+ case "mysql_db":
+ mysqlSettingWarning = true;
+ database = setting.getValue();
+ break;
+ case "mysql_user":
+ mysqlSettingWarning = true;
+ username = setting.getValue();
+ break;
+ case "mysql_pass":
+ mysqlSettingWarning = true;
+ password = setting.getValue();
+ break;
+ //
case "server_limit":
serverLimit = setting.getValue();
break;
@@ -125,25 +165,12 @@ public class BedrockConnect {
port = setting.getValue();
break;
case "nodb":
- //noDB = setting.getValue().equalsIgnoreCase("true");
if (setting.getValue().equalsIgnoreCase("true"))
{
+ nodbWarning = false;
databaseType = DatabaseTypes.nosql;
- noDB = setting.getValue().equalsIgnoreCase("true");
+ noDB = true;
}
-
- break;
- case "mysql":
- if (setting.getValue().equalsIgnoreCase("true"))
- databaseType = DatabaseTypes.mysql;
- break;
- case "mairadb":
- if (setting.getValue().equalsIgnoreCase("true"))
- databaseType = DatabaseTypes.mairadb;
- break;
- case "postgres":
- if (setting.getValue().equalsIgnoreCase("true"))
- databaseType = DatabaseTypes.postgres;
break;
case "custom_servers":
customServers = setting.getValue();
@@ -241,10 +268,22 @@ public class BedrockConnect {
}
}
- if(!noDB)
- System.out.println("Database Host: " + hostname + "\n" +
- "Database: " + database + "\n" +
- "Database User: " + username);
+
+ if(!noDB) {
+ if(nodbWarning || mysqlSettingWarning) {
+ System.out.println("----------------");
+ System.out.println("[!!DEPRECATION!!] Your current database settings may not work in future versions\n");
+ if(mysqlSettingWarning)
+ System.out.println("- mysql_* settings should be replaced with db_* settings");
+ if(nodbWarning)
+ System.out.println("- db_type should be manually set to mysql");
+ System.out.println("\nLearn more here: https://github.com/Pugmatt/BedrockConnect/wiki/Deprecated-Database-Settings");
+ System.out.println("----------------");
+ }
+ System.out.println("Database Host: " + hostname + "\n" +
+ "Database: " + database + "\n" +
+ "Database User: " + username);
+ }
System.out.println("\nServer Limit: " + serverLimit + "\n" + "Port: " + port + "\n");
diff --git a/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/sql/DatabaseTypes.java b/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/sql/DatabaseTypes.java
index 553c297..53fa144 100644
--- a/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/sql/DatabaseTypes.java
+++ b/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/sql/DatabaseTypes.java
@@ -3,6 +3,6 @@ package main.com.pyratron.pugmatt.bedrockconnect.sql;
public enum DatabaseTypes {
nosql,
mysql,
- mairadb,
+ mariadb,
postgres,
}
diff --git a/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/sql/MySQL.java b/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/sql/MySQL.java
index abcb2ff..a06aaba 100644
--- a/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/sql/MySQL.java
+++ b/serverlist-server/src/main/com/pyratron/pugmatt/bedrockconnect/sql/MySQL.java
@@ -60,7 +60,7 @@ public class MySQL extends Database {
Class.forName("com.mysql.cj.jdbc.Driver");
Driver = "jdbc:mysql://";
break;
- case mairadb:
+ case mariadb:
Class.forName("org.mariadb.jdbc.Driver");
Driver = "jdbc:mariadb://";
break;