diff --git a/src/main/java/xyz/vallat/louis/database/LanguageManager.java b/src/main/java/xyz/vallat/louis/database/LanguageManager.java index 37afc32..14c585d 100644 --- a/src/main/java/xyz/vallat/louis/database/LanguageManager.java +++ b/src/main/java/xyz/vallat/louis/database/LanguageManager.java @@ -42,10 +42,11 @@ public final class LanguageManager { importLanguageFile(connection); logger.debug("Saving new hash in database."); saveProperty(HASH_KEY, actualHash); - } + } else logger.debug("No need to import the language file. Hashes match."); } catch (SQLException | IOException | NoSuchAlgorithmException e) { logger.error("Cannot update the languages right now. Reason: {}", e.getMessage()); - if (storedHash == null || storedHash.isEmpty()) System.exit(ExitCodes.CANNOT_INITIALIZE_LANGUAGES.getValue()); + if (storedHash == null || storedHash.isEmpty()) + System.exit(ExitCodes.CANNOT_INITIALIZE_LANGUAGES.getValue()); logger.warn("Using language already in database. Please contact this bot's administrator to fix this issue."); } } diff --git a/src/main/java/xyz/vallat/louis/database/PropertyManager.java b/src/main/java/xyz/vallat/louis/database/PropertyManager.java index a2f1e87..1a6f266 100644 --- a/src/main/java/xyz/vallat/louis/database/PropertyManager.java +++ b/src/main/java/xyz/vallat/louis/database/PropertyManager.java @@ -20,7 +20,7 @@ public final class PropertyManager { logger.debug("Saving property '{}' with value '{}'.", key, value); try (Connection connection = DBManager.getConnection()) { String query; - if (getPropertyValue(key) == null) + if (getPropertyValue(key) != null) query = "UPDATE properties SET app_value = ? WHERE app_key = ?;"; else query = "INSERT INTO properties(app_value, app_key) VALUES (?, ?)"; try (PreparedStatement stmt = connection.prepareStatement(query)) {