Skip to content

Commit ba61dd5

Browse files
committed
#0028
1 parent 5e14b15 commit ba61dd5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/main/java/me/dergamer09/bungeesystem/BungeeSystem.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ public void onEnable() {
6060
return;
6161
}
6262

63+
// Verbindung zur Datenbank herstellen
64+
connectToDatabase();
65+
66+
if (connection == null) {
67+
getLogger().severe("Database connection is null! Plugin will not fully work.");
68+
return;
69+
}
70+
6371
// Registrierung der Befehle
6472
PluginManager pm = getProxy().getPluginManager();
6573
pm.registerCommand(this, new TeamChatCommand());
@@ -97,7 +105,6 @@ public void onEnable() {
97105
getProxy().getPluginManager().registerListener(this, new PlayerEventListener(this));
98106

99107
instance = this;
100-
connectToDatabase();
101108

102109
if (!getDataFolder().exists()) {
103110
getDataFolder().mkdir();
@@ -333,15 +340,15 @@ public Connection getConnection() {
333340
return connection;
334341
}
335342

336-
// Verbindung zur MySQL-Datenbank herstellen
343+
// Deine bereits vorhandene Methode
337344
private void connectToDatabase() {
338345
String host = config.getString("mysql.host");
339346
String port = config.getString("mysql.port");
340347
String database = config.getString("mysql.database");
341348
String username = config.getString("mysql.username");
342349
String password = config.getString("mysql.password");
343350

344-
String url = "jdbc:mysql://" + host + ":" + port + "/" + database;
351+
String url = "jdbc:mysql://" + host + ":" + port + "/" + database + "?useSSL=false";
345352

346353
try {
347354
connection = DriverManager.getConnection(url, username, password);

0 commit comments

Comments
 (0)