mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-24 17:47:38 +01:00
#605 Logger - name methods after their log level
- Remove separate print stacktrace method - Log level into the log similar to console output
This commit is contained in:
parent
dccbd5262f
commit
e7b980d435
@ -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!!");
|
||||
}
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class RegisterCommand extends PlayerCommand {
|
||||
private void handleEmailRegistration(Player player, List<String> 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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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?");
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
@ -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 +
|
||||
|
@ -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!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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... ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<PlayerAuth> 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 {
|
||||
|
@ -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(".*?");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user