Updated a big bug in the PropertyManager that caused properties to never save
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
a74b663e28
commit
7aafa7eda5
@ -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.");
|
||||
}
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user