mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Fix updating home privacy not working on SQLite
This commit is contained in:
1 parent
7a63e8c173
commit
a5d8b6ff35
3 files changed
+29
-8
No files matched your search
@@ -905,6 +905,7 @@ public class SqLiteDatabase extends Database {
|
||||
return CompletableFuture.runAsync(() -> getHome(home.uuid)
|
||||
.thenAccept(existingHome -> existingHome.ifPresentOrElse(presentHome -> {
|
||||
try {
|
||||
// Update the home's saved position, including metadata
|
||||
try (PreparedStatement statement = getConnection().prepareStatement(formatStatementTables("""
|
||||
SELECT `saved_position_id` FROM `%homes_table%`
|
||||
WHERE `uuid`=?;"""))) {
|
||||
@@ -915,6 +916,16 @@ public class SqLiteDatabase extends Database {
|
||||
updateSavedPosition(resultSet.getInt("saved_position_id"), home, connection);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the home privacy
|
||||
try (PreparedStatement statement = connection.prepareStatement(formatStatementTables("""
|
||||
UPDATE `%homes_table%`
|
||||
SET `public`=?
|
||||
WHERE `uuid`=?;"""))) {
|
||||
statement.setBoolean(1, home.isPublic);
|
||||
statement.setString(2, home.uuid.toString());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
getLogger().log(Level.SEVERE,
|
||||
"Failed to update a home in the database for " + home.owner.username, e);
|
||||
|
||||
Reference in new issue
Block a user