mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 06:28:49 +00:00
Tweak connection parameters
This commit is contained in:
1 parent
649d4c0600
commit
201c77ec4b
2 files changed
+6
-10
No files matched your search
@@ -54,7 +54,7 @@ public class Settings {
|
|||||||
public String mySqlPassword = "pa55w0rd";
|
public String mySqlPassword = "pa55w0rd";
|
||||||
|
|
||||||
@KeyPath("database.mysql.credentials.parameters")
|
@KeyPath("database.mysql.credentials.parameters")
|
||||||
public String mySqlConnectionParameters = "?useUnicode=true&characterEncoding=UTF-8&useSSL=false";
|
public String mySqlConnectionParameters = "?autoReconnect=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8";
|
||||||
|
|
||||||
@KeyPath("database.mysql.connection_pool")
|
@KeyPath("database.mysql.connection_pool")
|
||||||
public ConnectionPoolOptions mySqlPoolOptions = new ConnectionPoolOptions();
|
public ConnectionPoolOptions mySqlPoolOptions = new ConnectionPoolOptions();
|
||||||
|
|||||||
@@ -647,8 +647,8 @@ public class MySqlDatabase extends Database {
|
|||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Void> setCurrentTeleport(@NotNull User user, @Nullable Teleport teleport) {
|
public CompletableFuture<Void> setCurrentTeleport(@NotNull User user, @Nullable Teleport teleport) {
|
||||||
return CompletableFuture.runAsync(() -> {
|
return CompletableFuture.runAsync(() -> {
|
||||||
// Clear the user's current teleport
|
|
||||||
try (Connection connection = getConnection()) {
|
try (Connection connection = getConnection()) {
|
||||||
|
// Clear the user's current teleport
|
||||||
try (PreparedStatement deleteStatement = connection.prepareStatement(formatStatementTables("""
|
try (PreparedStatement deleteStatement = connection.prepareStatement(formatStatementTables("""
|
||||||
DELETE FROM `%positions_table%`
|
DELETE FROM `%positions_table%`
|
||||||
WHERE `id`=(
|
WHERE `id`=(
|
||||||
@@ -659,13 +659,9 @@ public class MySqlDatabase extends Database {
|
|||||||
deleteStatement.setString(1, user.uuid.toString());
|
deleteStatement.setString(1, user.uuid.toString());
|
||||||
deleteStatement.executeUpdate();
|
deleteStatement.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
|
||||||
getLogger().log(Level.SEVERE, "Failed to clear the current teleport of " + user.username, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the user's teleport into the database (if it's not null)
|
// Set the user's teleport into the database (if it's not null)
|
||||||
if (teleport != null) {
|
if (teleport != null) {
|
||||||
try (Connection connection = getConnection()) {
|
|
||||||
try (PreparedStatement statement = connection.prepareStatement(formatStatementTables("""
|
try (PreparedStatement statement = connection.prepareStatement(formatStatementTables("""
|
||||||
INSERT INTO `%teleports_table%` (`player_uuid`, `destination_id`, `type`)
|
INSERT INTO `%teleports_table%` (`player_uuid`, `destination_id`, `type`)
|
||||||
VALUES (?,?,?);"""))) {
|
VALUES (?,?,?);"""))) {
|
||||||
@@ -675,9 +671,9 @@ public class MySqlDatabase extends Database {
|
|||||||
|
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
|
||||||
getLogger().log(Level.SEVERE, "Failed to set the current teleport of " + user.username, e);
|
|
||||||
}
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
getLogger().log(Level.SEVERE, "Failed to clear the current teleport of " + user.username, e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user