#1874 Introduce individual ConsoleLogger instance per class (#1875)

* #1874 Introduce individual ConsoleLogger instance per class
- Create ConsoleLoggerFactory from which a separate logger can be created for each class
- Allows to support individual log level settings in the future

* Fix CodeStyle issue

* Replace full class name with import

* Update usages after merge from master
This commit is contained in:
ljacqu
2019-08-06 15:15:16 +02:00
committed by Gabriele C
parent 254d4d75a2
commit c34f00f759
98 changed files with 853 additions and 387 deletions
@@ -12,6 +12,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.util.Utils;
@@ -25,6 +26,8 @@ import java.util.stream.Collectors;
public class CacheDataSource implements DataSource {
private final ConsoleLogger logger = ConsoleLoggerFactory.get(CacheDataSource.class);
private final DataSource source;
private final PlayerCache playerCache;
private final LoadingCache<String, Optional<PlayerAuth>> cachedAuths;
@@ -164,7 +167,7 @@ public class CacheDataSource implements DataSource {
try {
executorService.awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
ConsoleLogger.logException("Could not close executor service:", e);
logger.logException("Could not close executor service:", e);
}
cachedAuths.invalidateAll();
source.closeConnection();
@@ -8,6 +8,7 @@ import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.columnshandler.AuthMeColumnsHandler;
import fr.xephi.authme.datasource.mysqlextensions.MySqlExtension;
import fr.xephi.authme.datasource.mysqlextensions.MySqlExtensionsFactory;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.settings.properties.HooksSettings;
@@ -34,6 +35,7 @@ import static fr.xephi.authme.datasource.SqlDataSourceUtils.logSqlException;
*/
@SuppressWarnings({"checkstyle:AbbreviationAsWordInName"}) // Justification: Class name cannot be changed anymore
public class MySQL extends AbstractSqlDataSource {
private final ConsoleLogger logger = ConsoleLoggerFactory.get(MySQL.class);
private boolean useSsl;
private boolean serverCertificateVerification;
@@ -58,14 +60,14 @@ public class MySQL extends AbstractSqlDataSource {
this.setConnectionArguments();
} catch (RuntimeException e) {
if (e instanceof IllegalArgumentException) {
ConsoleLogger.warning("Invalid database arguments! Please check your configuration!");
ConsoleLogger.warning("If this error persists, please report it to the developer!");
logger.warning("Invalid database arguments! Please check your configuration!");
logger.warning("If this error persists, please report it to the developer!");
}
if (e instanceof PoolInitializationException) {
ConsoleLogger.warning("Can't initialize database connection! Please check your configuration!");
ConsoleLogger.warning("If this error persists, please report it to the developer!");
logger.warning("Can't initialize database connection! Please check your configuration!");
logger.warning("If this error persists, please report it to the developer!");
}
ConsoleLogger.warning("Can't use the Hikari Connection Pool! Please, report this error to the developer!");
logger.warning("Can't use the Hikari Connection Pool! Please, report this error to the developer!");
throw e;
}
@@ -74,8 +76,8 @@ public class MySQL extends AbstractSqlDataSource {
checkTablesAndColumns();
} catch (SQLException e) {
closeConnection();
ConsoleLogger.logException("Can't initialize the MySQL database:", e);
ConsoleLogger.warning("Please check your database settings in the config.yml file!");
logger.logException("Can't initialize the MySQL database:", e);
logger.warning("Please check your database settings in the config.yml file!");
throw e;
}
}
@@ -149,7 +151,7 @@ public class MySQL extends AbstractSqlDataSource {
ds.addDataSourceProperty("prepStmtCacheSize", "275");
ds.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!");
logger.info("Connection arguments loaded, Hikari ConnectionPool ready!");
}
@Override
@@ -158,7 +160,7 @@ public class MySQL extends AbstractSqlDataSource {
ds.close();
}
setConnectionArguments();
ConsoleLogger.info("Hikari ConnectionPool arguments reloaded!");
logger.info("Hikari ConnectionPool arguments reloaded!");
}
private Connection getConnection() throws SQLException {
@@ -272,7 +274,7 @@ public class MySQL extends AbstractSqlDataSource {
+ " ADD COLUMN " + col.PLAYER_UUID + " VARCHAR(36)");
}
}
ConsoleLogger.info("MySQL setup finished");
logger.info("MySQL setup finished");
}
private boolean isColumnMissing(DatabaseMetaData metaData, String columnName) throws SQLException {
@@ -1,6 +1,7 @@
package fr.xephi.authme.datasource;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
@@ -12,6 +13,8 @@ import java.sql.Types;
* Performs migrations on the MySQL data source if necessary.
*/
final class MySqlMigrater {
private static ConsoleLogger logger = ConsoleLoggerFactory.get(MySqlMigrater.class);
private MySqlMigrater() {
}
@@ -35,7 +38,7 @@ final class MySqlMigrater {
String sql = String.format("ALTER TABLE %s MODIFY %s VARCHAR(40) CHARACTER SET ascii COLLATE ascii_bin",
tableName, col.LAST_IP);
st.execute(sql);
ConsoleLogger.info("Changed last login column to allow NULL values. Please verify the registration feature "
logger.info("Changed last login column to allow NULL values. Please verify the registration feature "
+ "if you are hooking into a forum.");
}
}
@@ -53,7 +56,7 @@ final class MySqlMigrater {
final int columnType;
try (ResultSet rs = metaData.getColumns(null, null, tableName, col.LAST_LOGIN)) {
if (!rs.next()) {
ConsoleLogger.warning("Could not get LAST_LOGIN meta data. This should never happen!");
logger.warning("Could not get LAST_LOGIN meta data. This should never happen!");
return;
}
columnType = rs.getInt("DATA_TYPE");
@@ -75,7 +78,7 @@ final class MySqlMigrater {
*/
private static void migrateLastLoginColumnFromInt(Statement st, String tableName, Columns col) throws SQLException {
// Change from int to bigint
ConsoleLogger.info("Migrating lastlogin column from int to bigint");
logger.info("Migrating lastlogin column from int to bigint");
String sql = String.format("ALTER TABLE %s MODIFY %s BIGINT;", tableName, col.LAST_LOGIN);
st.execute(sql);
@@ -86,7 +89,7 @@ final class MySqlMigrater {
tableName, col.LAST_LOGIN, col.LAST_LOGIN, col.LAST_LOGIN, rangeStart, col.LAST_LOGIN, rangeEnd);
int changedRows = st.executeUpdate(sql);
ConsoleLogger.warning("You may have entries with invalid timestamps. Please check your data "
logger.warning("You may have entries with invalid timestamps. Please check your data "
+ "before purging. " + changedRows + " rows were migrated from seconds to milliseconds.");
}
@@ -107,7 +110,7 @@ final class MySqlMigrater {
long currentTimestamp = System.currentTimeMillis();
int updatedRows = st.executeUpdate(String.format("UPDATE %s SET %s = %d;",
tableName, col.REGISTRATION_DATE, currentTimestamp));
ConsoleLogger.info("Created column '" + col.REGISTRATION_DATE + "' and set the current timestamp, "
logger.info("Created column '" + col.REGISTRATION_DATE + "' and set the current timestamp, "
+ currentTimestamp + ", to all " + updatedRows + " rows");
}
}
@@ -8,6 +8,7 @@ import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.columnshandler.AuthMeColumnsHandler;
import fr.xephi.authme.datasource.mysqlextensions.MySqlExtension;
import fr.xephi.authme.datasource.mysqlextensions.MySqlExtensionsFactory;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.settings.properties.HooksSettings;
@@ -32,6 +33,8 @@ import static fr.xephi.authme.datasource.SqlDataSourceUtils.logSqlException;
*/
public class PostgreSqlDataSource extends AbstractSqlDataSource {
private final ConsoleLogger logger = ConsoleLoggerFactory.get(PostgreSqlDataSource.class);
private String host;
private String port;
private String username;
@@ -53,14 +56,14 @@ public class PostgreSqlDataSource extends AbstractSqlDataSource {
this.setConnectionArguments();
} catch (RuntimeException e) {
if (e instanceof IllegalArgumentException) {
ConsoleLogger.warning("Invalid database arguments! Please check your configuration!");
ConsoleLogger.warning("If this error persists, please report it to the developer!");
logger.warning("Invalid database arguments! Please check your configuration!");
logger.warning("If this error persists, please report it to the developer!");
}
if (e instanceof PoolInitializationException) {
ConsoleLogger.warning("Can't initialize database connection! Please check your configuration!");
ConsoleLogger.warning("If this error persists, please report it to the developer!");
logger.warning("Can't initialize database connection! Please check your configuration!");
logger.warning("If this error persists, please report it to the developer!");
}
ConsoleLogger.warning("Can't use the Hikari Connection Pool! Please, report this error to the developer!");
logger.warning("Can't use the Hikari Connection Pool! Please, report this error to the developer!");
throw e;
}
@@ -69,8 +72,8 @@ public class PostgreSqlDataSource extends AbstractSqlDataSource {
checkTablesAndColumns();
} catch (SQLException e) {
closeConnection();
ConsoleLogger.logException("Can't initialize the PostgreSQL database:", e);
ConsoleLogger.warning("Please check your database settings in the config.yml file!");
logger.logException("Can't initialize the PostgreSQL database:", e);
logger.warning("Please check your database settings in the config.yml file!");
throw e;
}
}
@@ -129,7 +132,7 @@ public class PostgreSqlDataSource extends AbstractSqlDataSource {
ds.addDataSourceProperty("cachePrepStmts", "true");
ds.addDataSourceProperty("preparedStatementCacheQueries", "275");
ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!");
logger.info("Connection arguments loaded, Hikari ConnectionPool ready!");
}
@Override
@@ -138,7 +141,7 @@ public class PostgreSqlDataSource extends AbstractSqlDataSource {
ds.close();
}
setConnectionArguments();
ConsoleLogger.info("Hikari ConnectionPool arguments reloaded!");
logger.info("Hikari ConnectionPool arguments reloaded!");
}
private Connection getConnection() throws SQLException {
@@ -247,7 +250,7 @@ public class PostgreSqlDataSource extends AbstractSqlDataSource {
+ " ADD COLUMN " + col.PLAYER_UUID + " VARCHAR(36)");
}
}
ConsoleLogger.info("PostgreSQL setup finished");
logger.info("PostgreSQL setup finished");
}
private boolean isColumnMissing(DatabaseMetaData metaData, String columnName) throws SQLException {
@@ -4,6 +4,7 @@ import com.google.common.annotations.VisibleForTesting;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.columnshandler.AuthMeColumnsHandler;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.DatabaseSettings;
@@ -30,6 +31,7 @@ import static fr.xephi.authme.datasource.SqlDataSourceUtils.logSqlException;
@SuppressWarnings({"checkstyle:AbbreviationAsWordInName"}) // Justification: Class name cannot be changed anymore
public class SQLite extends AbstractSqlDataSource {
private final ConsoleLogger logger = ConsoleLoggerFactory.get(SQLite.class);
private final Settings settings;
private final File dataFolder;
private final String database;
@@ -57,7 +59,7 @@ public class SQLite extends AbstractSqlDataSource {
this.setup();
this.migrateIfNeeded();
} catch (Exception ex) {
ConsoleLogger.logException("Error during SQLite initialization:", ex);
logger.logException("Error during SQLite initialization:", ex);
throw ex;
}
}
@@ -85,7 +87,7 @@ public class SQLite extends AbstractSqlDataSource {
throw new IllegalStateException("Failed to load SQLite JDBC class", e);
}
ConsoleLogger.debug("SQLite driver loaded");
logger.debug("SQLite driver loaded");
this.con = DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database + ".db");
this.columnsHandler = AuthMeColumnsHandler.createForSqlite(con, settings);
}
@@ -188,7 +190,7 @@ public class SQLite extends AbstractSqlDataSource {
+ " ADD COLUMN " + col.PLAYER_UUID + " VARCHAR(36)");
}
}
ConsoleLogger.info("SQLite Setup finished");
logger.info("SQLite Setup finished");
}
/**
@@ -219,7 +221,7 @@ public class SQLite extends AbstractSqlDataSource {
this.setup();
this.migrateIfNeeded();
} catch (SQLException ex) {
ConsoleLogger.logException("Error while reloading SQLite:", ex);
logger.logException("Error while reloading SQLite:", ex);
}
}
@@ -398,7 +400,7 @@ public class SQLite extends AbstractSqlDataSource {
long currentTimestamp = System.currentTimeMillis();
int updatedRows = st.executeUpdate(String.format("UPDATE %s SET %s = %d;",
tableName, col.REGISTRATION_DATE, currentTimestamp));
ConsoleLogger.info("Created column '" + col.REGISTRATION_DATE + "' and set the current timestamp, "
logger.info("Created column '" + col.REGISTRATION_DATE + "' and set the current timestamp, "
+ currentTimestamp + ", to all " + updatedRows + " rows");
}
@@ -2,6 +2,7 @@ package fr.xephi.authme.datasource;
import com.google.common.io.Files;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.util.FileUtils;
@@ -19,6 +20,7 @@ import java.sql.Statement;
*/
class SqLiteMigrater {
private final ConsoleLogger logger = ConsoleLoggerFactory.get(SqLiteMigrater.class);
private final File dataFolder;
private final String databaseName;
private final String tableName;
@@ -53,13 +55,13 @@ class SqLiteMigrater {
* @param sqLite the instance to migrate
*/
void performMigration(SQLite sqLite) throws SQLException {
ConsoleLogger.warning("YOUR SQLITE DATABASE NEEDS MIGRATING! DO NOT TURN OFF YOUR SERVER");
logger.warning("YOUR SQLITE DATABASE NEEDS MIGRATING! DO NOT TURN OFF YOUR SERVER");
String backupName = createBackup();
ConsoleLogger.info("Made a backup of your database at 'backups/" + backupName + "'");
logger.info("Made a backup of your database at 'backups/" + backupName + "'");
recreateDatabaseWithNewDefinitions(sqLite);
ConsoleLogger.info("SQLite database migrated successfully");
logger.info("SQLite database migrated successfully");
}
private String createBackup() {
@@ -104,7 +106,7 @@ class SqLiteMigrater {
+ " CASE WHEN $email = 'your@email.com' THEN NULL ELSE $email END, $isLogged"
+ " FROM " + tempTable + ";";
int insertedEntries = st.executeUpdate(replaceColumnVariables(copySql));
ConsoleLogger.info("Copied over " + insertedEntries + " from the old table to the new one");
logger.info("Copied over " + insertedEntries + " from the old table to the new one");
st.execute("DROP TABLE " + tempTable + ";");
}
@@ -1,6 +1,7 @@
package fr.xephi.authme.datasource;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
@@ -11,6 +12,8 @@ import java.sql.SQLException;
*/
public final class SqlDataSourceUtils {
private static final ConsoleLogger logger = ConsoleLoggerFactory.get(SqlDataSourceUtils.class);
private SqlDataSourceUtils() {
}
@@ -20,7 +23,7 @@ public final class SqlDataSourceUtils {
* @param e the exception to log
*/
public static void logSqlException(SQLException e) {
ConsoleLogger.logException("Error during SQL operation:", e);
logger.logException("Error during SQL operation:", e);
}
/**
@@ -58,7 +61,7 @@ public final class SqlDataSourceUtils {
if (nullableCode == DatabaseMetaData.columnNoNulls) {
return true;
} else if (nullableCode == DatabaseMetaData.columnNullableUnknown) {
ConsoleLogger.warning("Unknown nullable status for column '" + columnName + "'");
logger.warning("Unknown nullable status for column '" + columnName + "'");
}
}
return false;
@@ -4,6 +4,7 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
@@ -18,8 +19,10 @@ import static fr.xephi.authme.util.Utils.logAndSendMessage;
*/
public abstract class AbstractDataSourceConverter<S extends DataSource> implements Converter {
private DataSource destination;
private DataSourceType destinationType;
private final ConsoleLogger logger = ConsoleLoggerFactory.get(MySqlToSqlite.class);
private final DataSource destination;
private final DataSourceType destinationType;
/**
* Constructor.
@@ -51,7 +54,7 @@ public abstract class AbstractDataSourceConverter<S extends DataSource> implemen
source = getSource();
} catch (Exception e) {
logAndSendMessage(sender, "The data source to convert from could not be initialized");
ConsoleLogger.logException("Could not initialize source:", e);
logger.logException("Could not initialize source:", e);
return;
}
@@ -60,7 +63,6 @@ public abstract class AbstractDataSourceConverter<S extends DataSource> implemen
if (destination.isAuthAvailable(auth.getNickname())) {
skippedPlayers.add(auth.getNickname());
} else {
adaptPlayerAuth(auth);
destination.saveAuth(auth);
destination.updateSession(auth);
destination.updateQuitLoc(auth);
@@ -75,15 +77,6 @@ public abstract class AbstractDataSourceConverter<S extends DataSource> implemen
+ " to " + destinationType);
}
/**
* Adapts the PlayerAuth from the source before it is saved in the destination.
*
* @param auth the auth from the source
*/
protected void adaptPlayerAuth(PlayerAuth auth) {
// noop
}
/**
* @return the data source to convert from
* @throws Exception during initialization of source
@@ -4,6 +4,7 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.ConverterSettings;
import org.bukkit.command.CommandSender;
@@ -19,6 +20,8 @@ import java.io.IOException;
*/
public class CrazyLoginConverter implements Converter {
private final ConsoleLogger logger = ConsoleLoggerFactory.get(CrazyLoginConverter.class);
private final DataSource database;
private final Settings settings;
private final File dataFolder;
@@ -46,10 +49,10 @@ public class CrazyLoginConverter implements Converter {
migrateAccount(line);
}
}
ConsoleLogger.info("CrazyLogin database has been imported correctly");
logger.info("CrazyLogin database has been imported correctly");
} catch (IOException ex) {
ConsoleLogger.warning("Can't open the crazylogin database file! Does it exist?");
ConsoleLogger.logException("Encountered", ex);
logger.warning("Can't open the crazylogin database file! Does it exist?");
logger.logException("Encountered", ex);
}
}
@@ -5,6 +5,7 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.ConverterSettings;
import fr.xephi.authme.util.UuidUtils;
@@ -31,6 +32,7 @@ import static fr.xephi.authme.util.Utils.logAndSendMessage;
*/
public class LoginSecurityConverter implements Converter {
private final ConsoleLogger logger = ConsoleLoggerFactory.get(LoginSecurityConverter.class);
private final File dataFolder;
private final DataSource dataSource;
@@ -60,7 +62,7 @@ public class LoginSecurityConverter implements Converter {
}
} catch (SQLException e) {
sender.sendMessage("Failed to convert from SQLite. Please see the log for more info");
ConsoleLogger.logException("Could not fetch or migrate data:", e);
logger.logException("Could not fetch or migrate data:", e);
}
}
@@ -189,7 +191,7 @@ public class LoginSecurityConverter implements Converter {
return DriverManager.getConnection(
"jdbc:sqlite:" + path, "trump", "donald");
} catch (SQLException e) {
ConsoleLogger.logException("Could not connect to SQLite database", e);
logger.logException("Could not connect to SQLite database", e);
return null;
}
}
@@ -199,7 +201,7 @@ public class LoginSecurityConverter implements Converter {
return DriverManager.getConnection(
"jdbc:mysql://" + mySqlHost + "/" + mySqlDatabase, mySqlUser, mySqlPassword);
} catch (SQLException e) {
ConsoleLogger.logException("Could not connect to SQLite database", e);
logger.logException("Could not connect to SQLite database", e);
return null;
}
}
@@ -4,6 +4,7 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.settings.Settings;
@@ -25,6 +26,7 @@ import java.util.Map.Entry;
*/
public class RakamakConverter implements Converter {
private final ConsoleLogger logger = ConsoleLoggerFactory.get(RakamakConverter.class);
private final DataSource database;
private final Settings settings;
private final File pluginFolder;
@@ -88,7 +90,7 @@ public class RakamakConverter implements Converter {
}
Utils.logAndSendMessage(sender, "Rakamak database has been imported successfully");
} catch (IOException ex) {
ConsoleLogger.logException("Can't open the rakamak database file! Does it exist?", ex);
logger.logException("Can't open the rakamak database file! Does it exist?", ex);
}
}
}
@@ -4,6 +4,7 @@ import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@@ -18,6 +19,9 @@ public class RoyalAuthConverter implements Converter {
private static final String LAST_LOGIN_PATH = "timestamps.quit";
private static final String PASSWORD_PATH = "login.password";
private final ConsoleLogger logger = ConsoleLoggerFactory.get(RoyalAuthConverter.class);
private final AuthMe plugin;
private final DataSource dataSource;
@@ -48,7 +52,7 @@ public class RoyalAuthConverter implements Converter {
dataSource.saveAuth(auth);
dataSource.updateSession(auth);
} catch (Exception e) {
ConsoleLogger.logException("Error while trying to import " + player.getName() + " RoyalAuth data", e);
logger.logException("Error while trying to import " + player.getName() + " RoyalAuth data", e);
}
}
}
@@ -4,6 +4,7 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
@@ -18,6 +19,7 @@ import static fr.xephi.authme.util.FileUtils.makePath;
public class VAuthConverter implements Converter {
private final ConsoleLogger logger = ConsoleLoggerFactory.get(VAuthConverter.class);
private final DataSource dataSource;
private final File vAuthPasswordsFile;
@@ -58,7 +60,7 @@ public class VAuthConverter implements Converter {
dataSource.saveAuth(auth);
}
} catch (IOException e) {
ConsoleLogger.logException("Error while trying to import some vAuth data", e);
logger.logException("Error while trying to import some vAuth data", e);
}
}