diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 397533cf1..6c86945c8 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -272,7 +272,7 @@ public class AuthMe extends JavaPlugin { // If server is using PermissionsBukkit, print a warning that some features may not be supported if (PermissionsSystemType.PERMISSIONS_BUKKIT.equals(permsMan.getPermissionSystem())) { - ConsoleLogger.showError("Warning! This server uses PermissionsBukkit for permissions. Some permissions features may not be supported!"); + ConsoleLogger.warning("Warning! This server uses PermissionsBukkit for permissions. Some permissions features may not be supported!"); } // Purge on start if enabled @@ -303,13 +303,13 @@ public class AuthMe extends JavaPlugin { private void showSettingsWarnings() { // Force single session disabled if (!newSettings.getProperty(RestrictionSettings.FORCE_SINGLE_SESSION)) { - ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); + ConsoleLogger.warning("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); } // Session timeout disabled if (newSettings.getProperty(PluginSettings.SESSIONS_TIMEOUT) == 0 && newSettings.getProperty(PluginSettings.SESSIONS_ENABLED)) { - ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); + ConsoleLogger.warning("WARNING!!! You set session timeout to 0, this may cause security issues!"); } } @@ -493,7 +493,7 @@ public class AuthMe extends JavaPlugin { // Stop/unload the server/plugin as defined in the configuration public void stopOrUnload() { if (Settings.isStopEnabled) { - ConsoleLogger.showError("THE SERVER IS GOING TO SHUT DOWN AS DEFINED IN THE CONFIGURATION!"); + ConsoleLogger.warning("THE SERVER IS GOING TO SHUT DOWN AS DEFINED IN THE CONFIGURATION!"); getServer().shutdown(); } else { getServer().getPluginManager().disablePlugin(this); @@ -544,7 +544,7 @@ public class AuthMe extends JavaPlugin { public void run() { int accounts = database.getAccountsRegistered(); if (accounts >= 4000) { - ConsoleLogger.showError("YOU'RE USING THE SQLITE DATABASE WITH " + ConsoleLogger.warning("YOU'RE USING THE SQLITE DATABASE WITH " + accounts + "+ ACCOUNTS; FOR BETTER PERFORMANCE, PLEASE UPGRADE TO MYSQL!!"); } } diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index b26a86257..be15079ce 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -59,7 +59,7 @@ public final class ConsoleLogger { public static void info(String message) { logger.info(message); if (useLogging) { - writeLog(message); + writeLog("[INFO] " + message); } } @@ -69,10 +69,10 @@ public final class ConsoleLogger { * * @param message String */ - public static void showError(String message) { + public static void warning(String message) { logger.warning(message); if (useLogging) { - writeLog("ERROR: " + message); + writeLog("[WARN] " + message); } } @@ -96,17 +96,6 @@ public final class ConsoleLogger { } } - /** - * Write a StackTrace into the log. - * - * @param th The Throwable whose stack trace should be logged - */ - public static void writeStackTrace(Throwable th) { - if (useLogging) { - writeLog(Throwables.getStackTraceAsString(th)); - } - } - /** * Logs a Throwable with the provided message and saves the stack trace to the log file. * @@ -114,8 +103,10 @@ public final class ConsoleLogger { * @param th The Throwable to log */ public static void logException(String message, Throwable th) { - showError(message + " " + StringUtils.formatException(th)); - writeStackTrace(th); + warning(message + " " + StringUtils.formatException(th)); + if (useLogging) { + writeLog(Throwables.getStackTraceAsString(th)); + } } public static void close() { diff --git a/src/main/java/fr/xephi/authme/PerformBackup.java b/src/main/java/fr/xephi/authme/PerformBackup.java index 4106001fd..f41e78301 100644 --- a/src/main/java/fr/xephi/authme/PerformBackup.java +++ b/src/main/java/fr/xephi/authme/PerformBackup.java @@ -60,7 +60,7 @@ public class PerformBackup { if (!settings.getProperty(BackupSettings.ENABLED)) { // Print a warning if the backup was requested via command or by another plugin if (cause == BackupCause.COMMAND || cause == BackupCause.OTHER) { - ConsoleLogger.showError("Can't perform a Backup: disabled in configuration. Cause of the Backup: " + ConsoleLogger.warning("Can't perform a Backup: disabled in configuration. Cause of the Backup: " + cause.name()); } return; @@ -76,7 +76,7 @@ public class PerformBackup { if (doBackup()) { ConsoleLogger.info("A backup has been performed successfully. Cause of the Backup: " + cause.name()); } else { - ConsoleLogger.showError("Error while performing a backup! Cause of the Backup: " + cause.name()); + ConsoleLogger.warning("Error while performing a backup! Cause of the Backup: " + cause.name()); } } @@ -90,7 +90,7 @@ public class PerformBackup { case SQLITE: return fileBackup(dbName + ".db"); default: - ConsoleLogger.showError("Unknown data source type '" + dataSourceType + "' for backup"); + ConsoleLogger.warning("Unknown data source type '" + dataSourceType + "' for backup"); } return false; @@ -113,7 +113,7 @@ public class PerformBackup { ConsoleLogger.info("Backup created successfully."); return true; } else { - ConsoleLogger.showError("Could not create the backup! (Windows)"); + ConsoleLogger.warning("Could not create the backup! (Windows)"); } } catch (IOException | InterruptedException e) { ConsoleLogger.logException("Error during Windows backup:", e); @@ -128,7 +128,7 @@ public class PerformBackup { ConsoleLogger.info("Backup created successfully."); return true; } else { - ConsoleLogger.showError("Could not create the backup!"); + ConsoleLogger.warning("Could not create the backup!"); } } catch (IOException | InterruptedException e) { ConsoleLogger.logException("Error during backup:", e); @@ -147,8 +147,7 @@ public class PerformBackup { copy("plugins" + File.separator + "AuthMe" + File.separator + backend, path + ".db"); return true; } catch (IOException ex) { - ConsoleLogger.showError("Encountered an error during file backup: " + StringUtils.formatException(ex)); - ConsoleLogger.writeStackTrace(ex); + ConsoleLogger.logException("Encountered an error during file backup:", ex); } return false; } @@ -166,7 +165,7 @@ public class PerformBackup { if (new File(windowsPath + "\\bin\\mysqldump.exe").exists()) { return true; } else { - ConsoleLogger.showError("Mysql Windows Path is incorrect. Please check it"); + ConsoleLogger.warning("Mysql Windows Path is incorrect. Please check it"); return false; } } diff --git a/src/main/java/fr/xephi/authme/cache/backup/PlayerDataStorage.java b/src/main/java/fr/xephi/authme/cache/backup/PlayerDataStorage.java index c4472b04f..2287c58e8 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/PlayerDataStorage.java +++ b/src/main/java/fr/xephi/authme/cache/backup/PlayerDataStorage.java @@ -47,7 +47,7 @@ public class PlayerDataStorage { cacheDir = new File(dataFolder, "playerdata"); if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) { - ConsoleLogger.showError("Failed to create userdata directory."); + ConsoleLogger.warning("Failed to create userdata directory."); } gson = new GsonBuilder() .registerTypeAdapter(PlayerData.class, new PlayerDataSerializer()) @@ -115,7 +115,7 @@ public class PlayerDataStorage { if (file.exists()) { FileUtils.purgeDirectory(file); if (!file.delete()) { - ConsoleLogger.showError("Failed to remove " + player.getName() + " cache."); + ConsoleLogger.warning("Failed to remove " + player.getName() + " cache."); } } } diff --git a/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java index 346b90722..b41bffada 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/RecoverEmailCommand.java @@ -41,7 +41,7 @@ public class RecoverEmailCommand extends PlayerCommand { final String playerName = player.getName(); if (!sendMailSsl.hasAllInformation()) { - ConsoleLogger.showError("Mail API is not set"); + ConsoleLogger.warning("Mail API is not set"); commandService.send(player, MessageKey.INCOMPLETE_EMAIL_SETTINGS); return; } @@ -63,7 +63,7 @@ public class RecoverEmailCommand extends PlayerCommand { return; } if (StringUtils.isEmpty(commandService.getProperty(EmailSettings.MAIL_ACCOUNT))) { - ConsoleLogger.showError("No mail account set in settings"); + ConsoleLogger.warning("No mail account set in settings"); commandService.send(player, MessageKey.ERROR); return; } diff --git a/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java index 7b2eb694f..0e3f055b2 100644 --- a/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java @@ -69,7 +69,7 @@ public class RegisterCommand extends PlayerCommand { private void handleEmailRegistration(Player player, List arguments) { if (!sendMailSsl.hasAllInformation()) { commandService.send(player, MessageKey.INCOMPLETE_EMAIL_SETTINGS); - ConsoleLogger.showError("Cannot register player '" + player.getName() + "': no email or password is set " + ConsoleLogger.warning("Cannot register player '" + player.getName() + "': no email or password is set " + "to send emails from. Please adjust your config at " + EmailSettings.MAIL_ACCOUNT.getPath()); return; } diff --git a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java index 5a8c547ad..ce2e834ac 100644 --- a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java +++ b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java @@ -61,7 +61,7 @@ public class CrazyLoginConverter implements Converter { } ConsoleLogger.info("CrazyLogin database has been imported correctly"); } catch (IOException ex) { - ConsoleLogger.showError("Can't open the crazylogin database file! Does it exist?"); + ConsoleLogger.warning("Can't open the crazylogin database file! Does it exist?"); ConsoleLogger.logException("Encountered", ex); } } diff --git a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java index 82b2540d6..64f89b7e5 100644 --- a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java @@ -43,7 +43,7 @@ public class ForceFlatToSqlite { } if (!skippedPlayers.isEmpty()) { - ConsoleLogger.showError("Warning: skipped conversion for players which were already in SQLite: " + ConsoleLogger.warning("Warning: skipped conversion for players which were already in SQLite: " + StringUtils.join(", ", skippedPlayers)); } ConsoleLogger.info("Database successfully converted from " + source.getClass().getSimpleName() diff --git a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java index e568bb8b4..f6350119c 100644 --- a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java @@ -89,7 +89,7 @@ public class RakamakConverter implements Converter { ConsoleLogger.info("Rakamak database has been imported correctly"); sender.sendMessage("Rakamak database has been imported correctly"); } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); sender.sendMessage("Can't open the rakamak database file! Does it exist?"); } } diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index cb916378f..82e3a9aa8 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -160,7 +160,7 @@ public class CacheDataSource implements DataSource { try { executorService.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { - ConsoleLogger.writeStackTrace(e); + ConsoleLogger.logException("Could not close executor service:", e); } } diff --git a/src/main/java/fr/xephi/authme/datasource/FlatFile.java b/src/main/java/fr/xephi/authme/datasource/FlatFile.java index 592309b0d..b9a0bc89e 100644 --- a/src/main/java/fr/xephi/authme/datasource/FlatFile.java +++ b/src/main/java/fr/xephi/authme/datasource/FlatFile.java @@ -50,7 +50,7 @@ public class FlatFile implements DataSource { } catch (IOException e) { ConsoleLogger.logException("Cannot open flatfile", e); if (Settings.isStopEnabled) { - ConsoleLogger.showError("Can't use FLAT FILE... SHUTDOWN..."); + ConsoleLogger.warning("Can't use FLAT FILE... SHUTDOWN..."); instance.getServer().shutdown(); } if (!Settings.isStopEnabled) { @@ -82,7 +82,7 @@ public class FlatFile implements DataSource { } } } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return false; } finally { silentClose(br); @@ -109,7 +109,7 @@ public class FlatFile implements DataSource { bw = new BufferedWriter(new FileWriter(source, true)); bw.write(auth.getNickname() + ":" + auth.getPassword().getHash() + ":" + auth.getIp() + ":" + auth.getLastLogin() + ":" + auth.getQuitLocX() + ":" + auth.getQuitLocY() + ":" + auth.getQuitLocZ() + ":" + auth.getWorld() + ":" + auth.getEmail() + "\n"); } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return false; } finally { silentClose(bw); @@ -145,7 +145,7 @@ public class FlatFile implements DataSource { } } } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return false; } finally { silentClose(br); @@ -179,7 +179,7 @@ public class FlatFile implements DataSource { } } } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return false; } finally { silentClose(br); @@ -216,7 +216,7 @@ public class FlatFile implements DataSource { } } } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return false; } finally { silentClose(br); @@ -246,7 +246,7 @@ public class FlatFile implements DataSource { } } } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return list; } finally { silentClose(br); @@ -279,7 +279,7 @@ public class FlatFile implements DataSource { bw.write(l + "\n"); } } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return; } finally { silentClose(br); @@ -309,7 +309,7 @@ public class FlatFile implements DataSource { bw.write(l + "\n"); } } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return false; } finally { silentClose(br); @@ -331,7 +331,7 @@ public class FlatFile implements DataSource { } } } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return null; } finally { silentClose(br); @@ -364,10 +364,10 @@ public class FlatFile implements DataSource { } } } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return false; } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return false; } finally { if (br != null) { @@ -399,10 +399,10 @@ public class FlatFile implements DataSource { } return countIp; } catch (FileNotFoundException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return new ArrayList<>(); } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return new ArrayList<>(); } finally { if (br != null) { @@ -429,7 +429,7 @@ public class FlatFile implements DataSource { } return countEmail; } catch (IOException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); } finally { if (br != null) { try { @@ -473,7 +473,7 @@ public class FlatFile implements DataSource { result++; } } catch (Exception ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return result; } finally { silentClose(br); diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 0bb9a3d0f..ed89fa6b1 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -52,14 +52,14 @@ public class MySQL implements DataSource { this.setConnectionArguments(); } catch (RuntimeException e) { if (e instanceof IllegalArgumentException) { - ConsoleLogger.showError("Invalid database arguments! Please check your configuration!"); - ConsoleLogger.showError("If this error persists, please report it to the developer!"); + ConsoleLogger.warning("Invalid database arguments! Please check your configuration!"); + ConsoleLogger.warning("If this error persists, please report it to the developer!"); } if (e instanceof PoolInitializationException) { - ConsoleLogger.showError("Can't initialize database connection! Please check your configuration!"); - ConsoleLogger.showError("If this error persists, please report it to the developer!"); + ConsoleLogger.warning("Can't initialize database connection! Please check your configuration!"); + ConsoleLogger.warning("If this error persists, please report it to the developer!"); } - ConsoleLogger.showError("Can't use the Hikari Connection Pool! Please, report this error to the developer!"); + ConsoleLogger.warning("Can't use the Hikari Connection Pool! Please, report this error to the developer!"); throw e; } @@ -69,7 +69,7 @@ public class MySQL implements DataSource { } catch (SQLException e) { close(); ConsoleLogger.logException("Can't initialize the MySQL database:", e); - ConsoleLogger.showError("Please check your database settings in the config.yml file!"); + ConsoleLogger.warning("Please check your database settings in the config.yml file!"); throw e; } } @@ -879,7 +879,7 @@ public class MySQL implements DataSource { final int columnType; try (ResultSet rs = metaData.getColumns(null, null, tableName, col.LAST_LOGIN)) { if (!rs.next()) { - ConsoleLogger.showError("Could not get LAST_LOGIN meta data. This should never happen!"); + ConsoleLogger.warning("Could not get LAST_LOGIN meta data. This should never happen!"); return; } columnType = rs.getInt("DATA_TYPE"); diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index 0edbdf751..97bc4ba21 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -157,7 +157,7 @@ public class SQLite implements DataSource { rs = pst.executeQuery(); return rs.next(); } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); + ConsoleLogger.warning(ex.getMessage()); return false; } finally { close(rs); @@ -212,7 +212,7 @@ public class SQLite implements DataSource { HashedPassword password = auth.getPassword(); if (col.SALT.isEmpty()) { if (!StringUtils.isEmpty(auth.getPassword().getSalt())) { - ConsoleLogger.showError("Warning! Detected hashed password with separate salt but the salt column " + ConsoleLogger.warning("Warning! Detected hashed password with separate salt but the salt column " + "is not set in the config!"); } pst = con.prepareStatement("INSERT INTO " + tableName + "(" + col.NAME + "," + col.PASSWORD + diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index 73fd1c261..3dd46296c 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -53,7 +53,7 @@ public class AuthMeServerListener implements Listener { if (pluginName.equalsIgnoreCase("ProtocolLib")) { protocolLibService.disable(); - ConsoleLogger.showError("ProtocolLib has been disabled, unhooking packet adapters!"); + ConsoleLogger.warning("ProtocolLib has been disabled, unhooking packet adapters!"); } } diff --git a/src/main/java/fr/xephi/authme/listener/protocollib/AuthMeTabCompletePacketAdapter.java b/src/main/java/fr/xephi/authme/listener/protocollib/AuthMeTabCompletePacketAdapter.java index 2aef7d066..0a02ca553 100644 --- a/src/main/java/fr/xephi/authme/listener/protocollib/AuthMeTabCompletePacketAdapter.java +++ b/src/main/java/fr/xephi/authme/listener/protocollib/AuthMeTabCompletePacketAdapter.java @@ -24,7 +24,7 @@ class AuthMeTabCompletePacketAdapter extends PacketAdapter { event.setCancelled(true); } } catch (FieldAccessException e) { - ConsoleLogger.showError("Couldn't access field."); + ConsoleLogger.warning("Couldn't access field."); } } } diff --git a/src/main/java/fr/xephi/authme/listener/protocollib/ProtocolLibService.java b/src/main/java/fr/xephi/authme/listener/protocollib/ProtocolLibService.java index c54229865..3a817b78a 100644 --- a/src/main/java/fr/xephi/authme/listener/protocollib/ProtocolLibService.java +++ b/src/main/java/fr/xephi/authme/listener/protocollib/ProtocolLibService.java @@ -42,11 +42,11 @@ public class ProtocolLibService implements SettingsDependent { // Check if ProtocolLib is enabled on the server. if (!plugin.getServer().getPluginManager().isPluginEnabled("ProtocolLib")) { if (protectInvBeforeLogin) { - ConsoleLogger.showError("WARNING! The protectInventory feature requires ProtocolLib! Disabling it..."); + ConsoleLogger.warning("WARNING! The protectInventory feature requires ProtocolLib! Disabling it..."); } if (denyTabCompleteBeforeLogin) { - ConsoleLogger.showError("WARNING! The denyTabComplete feature requires ProtocolLib! Disabling it..."); + ConsoleLogger.warning("WARNING! The denyTabComplete feature requires ProtocolLib! Disabling it..."); } this.isEnabled = false; diff --git a/src/main/java/fr/xephi/authme/mail/SendMailSSL.java b/src/main/java/fr/xephi/authme/mail/SendMailSSL.java index 949f37774..6cd35c28e 100644 --- a/src/main/java/fr/xephi/authme/mail/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/mail/SendMailSSL.java @@ -58,7 +58,7 @@ public class SendMailSSL { */ public void sendPasswordMail(final PlayerAuth auth, final String newPass) { if (!hasAllInformation()) { - ConsoleLogger.showError("Cannot perform email registration: not all email settings are complete"); + ConsoleLogger.warning("Cannot perform email registration: not all email settings are complete"); return; } diff --git a/src/main/java/fr/xephi/authme/output/Messages.java b/src/main/java/fr/xephi/authme/output/Messages.java index 628099c4d..1f2a7e660 100644 --- a/src/main/java/fr/xephi/authme/output/Messages.java +++ b/src/main/java/fr/xephi/authme/output/Messages.java @@ -75,7 +75,7 @@ public class Messages implements SettingsDependent { String message = configuration.getString(code); if (message == null) { - ConsoleLogger.showError("Error getting message with key '" + code + "'. " + ConsoleLogger.warning("Error getting message with key '" + code + "'. " + "Please verify your config file at '" + fileName + "'"); return formatMessage(getDefault(code)); } @@ -112,7 +112,7 @@ public class Messages implements SettingsDependent { message = message.replace(tags[i], replacements[i]); } } else { - ConsoleLogger.showError("Invalid number of replacements for message key '" + key + "'"); + ConsoleLogger.warning("Invalid number of replacements for message key '" + key + "'"); } return message; } diff --git a/src/main/java/fr/xephi/authme/permission/AuthGroupHandler.java b/src/main/java/fr/xephi/authme/permission/AuthGroupHandler.java index 17d8fa89d..332d21378 100644 --- a/src/main/java/fr/xephi/authme/permission/AuthGroupHandler.java +++ b/src/main/java/fr/xephi/authme/permission/AuthGroupHandler.java @@ -45,7 +45,7 @@ public class AuthGroupHandler { // Make sure group support is available if (!permissionsManager.hasGroupSupport()) { - ConsoleLogger.showError("The current permissions system doesn't have group support, unable to set group!"); + ConsoleLogger.warning("The current permissions system doesn't have group support, unable to set group!"); return false; } diff --git a/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java b/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java index d7aa31279..d61d39c28 100644 --- a/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java +++ b/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java @@ -47,7 +47,7 @@ public class AsyncAddEmail implements AsynchronousProcess { playerCache.updatePlayer(auth); service.send(player, MessageKey.EMAIL_ADDED_SUCCESS); } else { - ConsoleLogger.showError("Could not save email for player '" + player + "'"); + ConsoleLogger.warning("Could not save email for player '" + player + "'"); service.send(player, MessageKey.ERROR); } } diff --git a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java index 2c2d7e11c..fe96300e6 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java @@ -204,7 +204,7 @@ public class AsynchronousLogin implements AsynchronousProcess { } } } else { - ConsoleLogger.showError("Player " + name + " wasn't online during login process, aborted... "); + ConsoleLogger.warning("Player " + name + " wasn't online during login process, aborted... "); } } diff --git a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java index cda26091d..e8bd8f654 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java +++ b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java @@ -38,7 +38,7 @@ public class BCRYPT implements EncryptionMethod { try { return hash.getHash().length() > 3 && BCryptService.checkpw(password, hash.getHash()); } catch (IllegalArgumentException e) { - ConsoleLogger.showError("Bcrypt checkpw() returned " + StringUtils.formatException(e)); + ConsoleLogger.warning("Bcrypt checkpw() returned " + StringUtils.formatException(e)); } return false; } diff --git a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java index 27ca14f87..79d06e0a8 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java +++ b/src/main/java/fr/xephi/authme/security/crypts/CryptPBKDF2Django.java @@ -32,7 +32,7 @@ public class CryptPBKDF2Django extends HexSaltedMethod { try { iterations = Integer.parseInt(line[1]); } catch (NumberFormatException e) { - ConsoleLogger.showError("Could not read number of rounds for CryptPBKDF2Django:" + ConsoleLogger.warning("Could not read number of rounds for CryptPBKDF2Django:" + StringUtils.formatException(e)); return false; } diff --git a/src/main/java/fr/xephi/authme/security/crypts/IPB4.java b/src/main/java/fr/xephi/authme/security/crypts/IPB4.java index e54bcd038..95a3bfd2a 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/IPB4.java +++ b/src/main/java/fr/xephi/authme/security/crypts/IPB4.java @@ -36,7 +36,7 @@ public class IPB4 implements EncryptionMethod { try { return hash.getHash().length() > 3 && BCryptService.checkpw(password, hash.getHash()); } catch (IllegalArgumentException e) { - ConsoleLogger.showError("Bcrypt checkpw() returned " + StringUtils.formatException(e)); + ConsoleLogger.warning("Bcrypt checkpw() returned " + StringUtils.formatException(e)); } return false; } diff --git a/src/main/java/fr/xephi/authme/security/crypts/XFBCRYPT.java b/src/main/java/fr/xephi/authme/security/crypts/XFBCRYPT.java index 4f7ed04ca..c3487f311 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/XFBCRYPT.java +++ b/src/main/java/fr/xephi/authme/security/crypts/XFBCRYPT.java @@ -31,7 +31,7 @@ public class XFBCRYPT implements EncryptionMethod { try { return hash.getHash().length() > 3 && BCryptService.checkpw(password, hash.getHash()); } catch (IllegalArgumentException e) { - ConsoleLogger.showError("XfBCrypt checkpw() returned " + StringUtils.formatException(e)); + ConsoleLogger.warning("XfBCrypt checkpw() returned " + StringUtils.formatException(e)); } return false; } diff --git a/src/main/java/fr/xephi/authme/settings/propertymap/Node.java b/src/main/java/fr/xephi/authme/settings/propertymap/Node.java index 5586a578f..7d281989e 100644 --- a/src/main/java/fr/xephi/authme/settings/propertymap/Node.java +++ b/src/main/java/fr/xephi/authme/settings/propertymap/Node.java @@ -77,7 +77,7 @@ final class Node { } if (commonNode == null) { - ConsoleLogger.showError("Could not find common node for '" + fullPath1 + "' at index " + commonCount); + ConsoleLogger.warning("Could not find common node for '" + fullPath1 + "' at index " + commonCount); return fullPath1.compareTo(fullPath2); // fallback } else if (commonCount >= path1.length || commonCount >= path2.length) { return Integer.compare(path1.length, path2.length); diff --git a/src/main/java/fr/xephi/authme/task/PurgeService.java b/src/main/java/fr/xephi/authme/task/PurgeService.java index e84fae41d..8d30d7a18 100644 --- a/src/main/java/fr/xephi/authme/task/PurgeService.java +++ b/src/main/java/fr/xephi/authme/task/PurgeService.java @@ -76,7 +76,7 @@ public class PurgeService implements Reloadable { if (!settings.getProperty(PurgeSettings.USE_AUTO_PURGE)) { return; } else if (daysBeforePurge <= 0) { - ConsoleLogger.showError("Did not run auto purge: configured days before purging must be positive"); + ConsoleLogger.warning("Did not run auto purge: configured days before purging must be positive"); return; } diff --git a/src/main/java/fr/xephi/authme/util/BukkitService.java b/src/main/java/fr/xephi/authme/util/BukkitService.java index 652105e74..6913c2afa 100644 --- a/src/main/java/fr/xephi/authme/util/BukkitService.java +++ b/src/main/java/fr/xephi/authme/util/BukkitService.java @@ -190,7 +190,7 @@ public class BukkitService { return Arrays.asList((Player[]) obj); } else { String type = (obj == null) ? "null" : obj.getClass().getName(); - ConsoleLogger.showError("Unknown list of online players of type " + type); + ConsoleLogger.warning("Unknown list of online players of type " + type); } } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { ConsoleLogger.logException("Could not retrieve list of online players:", e); @@ -230,7 +230,7 @@ public class BukkitService { Method method = Bukkit.class.getDeclaredMethod("getOnlinePlayers"); return method.getReturnType() == Collection.class; } catch (NoSuchMethodException e) { - ConsoleLogger.showError("Error verifying if getOnlinePlayers is a collection! Method doesn't exist"); + ConsoleLogger.warning("Error verifying if getOnlinePlayers is a collection! Method doesn't exist"); } return false; } diff --git a/src/main/java/fr/xephi/authme/util/FileUtils.java b/src/main/java/fr/xephi/authme/util/FileUtils.java index bd9c7fb9c..0d4a30b82 100644 --- a/src/main/java/fr/xephi/authme/util/FileUtils.java +++ b/src/main/java/fr/xephi/authme/util/FileUtils.java @@ -30,7 +30,7 @@ public class FileUtils { if (destinationFile.exists()) { return true; } else if (!destinationFile.getParentFile().exists() && !destinationFile.getParentFile().mkdirs()) { - ConsoleLogger.showError("Cannot create parent directories for '" + destinationFile + "'"); + ConsoleLogger.warning("Cannot create parent directories for '" + destinationFile + "'"); return false; } @@ -38,7 +38,7 @@ public class FileUtils { final String normalizedPath = resourcePath.replace("\\", "/"); try (InputStream is = AuthMe.class.getClassLoader().getResourceAsStream(normalizedPath)) { if (is == null) { - ConsoleLogger.showError(format("Cannot copy resource '%s' to file '%s': cannot load resource", + ConsoleLogger.warning(format("Cannot copy resource '%s' to file '%s': cannot load resource", resourcePath, destinationFile.getPath())); } else { Files.copy(is, destinationFile.toPath()); diff --git a/src/main/java/fr/xephi/authme/util/GeoLiteAPI.java b/src/main/java/fr/xephi/authme/util/GeoLiteAPI.java index ec66d5082..082e5c3f2 100644 --- a/src/main/java/fr/xephi/authme/util/GeoLiteAPI.java +++ b/src/main/java/fr/xephi/authme/util/GeoLiteAPI.java @@ -65,7 +65,7 @@ public class GeoLiteAPI { } } else { if (!dataFile.delete()) { - ConsoleLogger.showError("Failed to delete GeoLiteAPI database"); + ConsoleLogger.warning("Failed to delete GeoLiteAPI database"); } } } diff --git a/src/main/java/fr/xephi/authme/util/MigrationService.java b/src/main/java/fr/xephi/authme/util/MigrationService.java index cd9bb382b..8f786287e 100644 --- a/src/main/java/fr/xephi/authme/util/MigrationService.java +++ b/src/main/java/fr/xephi/authme/util/MigrationService.java @@ -34,14 +34,14 @@ public final class MigrationService { public static void changePlainTextToSha256(NewSetting settings, DataSource dataSource, SHA256 authmeSha256) { if (HashAlgorithm.PLAINTEXT == settings.getProperty(SecuritySettings.PASSWORD_HASH)) { - ConsoleLogger.showError("Your HashAlgorithm has been detected as plaintext and is now deprecated;" + ConsoleLogger.warning("Your HashAlgorithm has been detected as plaintext and is now deprecated;" + " it will be changed and hashed now to the AuthMe default hashing method"); - ConsoleLogger.showError("Don't stop your server; wait for the conversion to have been completed!"); + ConsoleLogger.warning("Don't stop your server; wait for the conversion to have been completed!"); List allAuths = dataSource.getAllAuths(); for (PlayerAuth auth : allAuths) { String hash = auth.getPassword().getHash(); if (hash.startsWith("$SHA$")) { - ConsoleLogger.showError("Skipping conversion for " + auth.getNickname() + "; detected SHA hash"); + ConsoleLogger.warning("Skipping conversion for " + auth.getNickname() + "; detected SHA hash"); } else { HashedPassword hashedPassword = authmeSha256.computeHash(hash, auth.getNickname()); auth.setPassword(hashedPassword); @@ -63,7 +63,7 @@ public final class MigrationService { */ public static DataSource convertFlatfileToSqlite(NewSetting settings, DataSource dataSource) { if (DataSourceType.FILE == settings.getProperty(DatabaseSettings.BACKEND)) { - ConsoleLogger.showError("FlatFile backend has been detected and is now deprecated; it will be changed " + ConsoleLogger.warning("FlatFile backend has been detected and is now deprecated; it will be changed " + "to SQLite... Connection will be impossible until conversion is done!"); FlatFile flatFile = (FlatFile) dataSource; try { diff --git a/src/main/java/fr/xephi/authme/util/Utils.java b/src/main/java/fr/xephi/authme/util/Utils.java index 899d2d6ce..da05edb6e 100644 --- a/src/main/java/fr/xephi/authme/util/Utils.java +++ b/src/main/java/fr/xephi/authme/util/Utils.java @@ -51,7 +51,7 @@ public final class Utils { try { return Pattern.compile(pattern); } catch (Exception e) { - ConsoleLogger.showError("Failed to compile pattern '" + pattern + "' - defaulting to allowing everything"); + ConsoleLogger.warning("Failed to compile pattern '" + pattern + "' - defaulting to allowing everything"); return Pattern.compile(".*?"); } }