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);
|
importLanguageFile(connection);
|
||||||
logger.debug("Saving new hash in database.");
|
logger.debug("Saving new hash in database.");
|
||||||
saveProperty(HASH_KEY, actualHash);
|
saveProperty(HASH_KEY, actualHash);
|
||||||
}
|
} else logger.debug("No need to import the language file. Hashes match.");
|
||||||
} catch (SQLException | IOException | NoSuchAlgorithmException e) {
|
} catch (SQLException | IOException | NoSuchAlgorithmException e) {
|
||||||
logger.error("Cannot update the languages right now. Reason: {}", e.getMessage());
|
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.");
|
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);
|
logger.debug("Saving property '{}' with value '{}'.", key, value);
|
||||||
try (Connection connection = DBManager.getConnection()) {
|
try (Connection connection = DBManager.getConnection()) {
|
||||||
String query;
|
String query;
|
||||||
if (getPropertyValue(key) == null)
|
if (getPropertyValue(key) != null)
|
||||||
query = "UPDATE properties SET app_value = ? WHERE app_key = ?;";
|
query = "UPDATE properties SET app_value = ? WHERE app_key = ?;";
|
||||||
else query = "INSERT INTO properties(app_value, app_key) VALUES (?, ?)";
|
else query = "INSERT INTO properties(app_value, app_key) VALUES (?, ?)";
|
||||||
try (PreparedStatement stmt = connection.prepareStatement(query)) {
|
try (PreparedStatement stmt = connection.prepareStatement(query)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user