* #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:
@@ -3,6 +3,8 @@ package fr.xephi.authme.service;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.datasource.DataSourceType;
|
||||
import fr.xephi.authme.initialization.DataFolder;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.mail.EmailService;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.BackupSettings;
|
||||
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||
@@ -25,10 +27,13 @@ import static fr.xephi.authme.util.Utils.logAndSendWarning;
|
||||
*/
|
||||
public class BackupService {
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(EmailService.class);
|
||||
|
||||
private final File dataFolder;
|
||||
private final File backupFolder;
|
||||
private final Settings settings;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -89,7 +94,7 @@ public class BackupService {
|
||||
String dbName = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
|
||||
return performFileBackup(dbName + ".db");
|
||||
default:
|
||||
ConsoleLogger.warning("Unknown data source type '" + dataSourceType + "' for backup");
|
||||
logger.warning("Unknown data source type '" + dataSourceType + "' for backup");
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -114,13 +119,13 @@ public class BackupService {
|
||||
Process runtimeProcess = Runtime.getRuntime().exec(backupCommand);
|
||||
int processComplete = runtimeProcess.waitFor();
|
||||
if (processComplete == 0) {
|
||||
ConsoleLogger.info("Backup created successfully. (Using Windows = " + isUsingWindows + ")");
|
||||
logger.info("Backup created successfully. (Using Windows = " + isUsingWindows + ")");
|
||||
return true;
|
||||
} else {
|
||||
ConsoleLogger.warning("Could not create the backup! (Using Windows = " + isUsingWindows + ")");
|
||||
logger.warning("Could not create the backup! (Using Windows = " + isUsingWindows + ")");
|
||||
}
|
||||
} catch (IOException | InterruptedException e) {
|
||||
ConsoleLogger.logException("Error during backup (using Windows = " + isUsingWindows + "):", e);
|
||||
logger.logException("Error during backup (using Windows = " + isUsingWindows + "):", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -133,7 +138,7 @@ public class BackupService {
|
||||
copy(new File(dataFolder, filename), backupFile);
|
||||
return true;
|
||||
} catch (IOException ex) {
|
||||
ConsoleLogger.logException("Encountered an error during file backup:", ex);
|
||||
logger.logException("Encountered an error during file backup:", ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -145,13 +150,13 @@ public class BackupService {
|
||||
* @param windowsPath The path to check
|
||||
* @return True if the path is correct, false if it is incorrect or the OS is not Windows
|
||||
*/
|
||||
private static boolean useWindowsCommand(String windowsPath) {
|
||||
private boolean useWindowsCommand(String windowsPath) {
|
||||
String isWin = System.getProperty("os.name").toLowerCase();
|
||||
if (isWin.contains("win")) {
|
||||
if (new File(windowsPath + "\\bin\\mysqldump.exe").exists()) {
|
||||
return true;
|
||||
} else {
|
||||
ConsoleLogger.warning("Mysql Windows Path is incorrect. Please check it");
|
||||
logger.warning("Mysql Windows Path is incorrect. Please check it");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.maxmind.db.model.Country;
|
||||
import com.maxmind.db.model.CountryResponse;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.initialization.DataFolder;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.util.FileUtils;
|
||||
import fr.xephi.authme.util.InternetProtocolUtils;
|
||||
|
||||
@@ -61,6 +62,7 @@ public class GeoIpService {
|
||||
// but every HTTP implementation have to support RFC 1023
|
||||
private static final String TIME_RFC_1023 = "EEE, dd-MMM-yy HH:mm:ss zzz";
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(GeoIpService.class);
|
||||
private final Path dataFile;
|
||||
private final BukkitService bukkitService;
|
||||
|
||||
@@ -109,10 +111,10 @@ public class GeoIpService {
|
||||
// don't fire the update task - we are up to date
|
||||
return true;
|
||||
} else {
|
||||
ConsoleLogger.debug("GEO IP database is older than " + UPDATE_INTERVAL_DAYS + " Days");
|
||||
logger.debug("GEO IP database is older than " + UPDATE_INTERVAL_DAYS + " Days");
|
||||
}
|
||||
} catch (IOException ioEx) {
|
||||
ConsoleLogger.logException("Failed to load GeoLiteAPI database", ioEx);
|
||||
logger.logException("Failed to load GeoLiteAPI database", ioEx);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -130,7 +132,7 @@ public class GeoIpService {
|
||||
* Tries to update the database by downloading a new version from the website.
|
||||
*/
|
||||
private void updateDatabase() {
|
||||
ConsoleLogger.info("Downloading GEO IP database, because the old database is older than "
|
||||
logger.info("Downloading GEO IP database, because the old database is older than "
|
||||
+ UPDATE_INTERVAL_DAYS + " days or doesn't exist");
|
||||
|
||||
Path tempFile = null;
|
||||
@@ -138,7 +140,7 @@ public class GeoIpService {
|
||||
// download database to temporarily location
|
||||
tempFile = Files.createTempFile(ARCHIVE_FILE, null);
|
||||
if (!downloadDatabaseArchive(tempFile)) {
|
||||
ConsoleLogger.info("There is no newer GEO IP database uploaded to MaxMind. Using the old one for now.");
|
||||
logger.info("There is no newer GEO IP database uploaded to MaxMind. Using the old one for now.");
|
||||
startReading();
|
||||
return;
|
||||
}
|
||||
@@ -151,10 +153,10 @@ public class GeoIpService {
|
||||
extractDatabase(tempFile, dataFile);
|
||||
|
||||
//only set this value to false on success otherwise errors could lead to endless download triggers
|
||||
ConsoleLogger.info("Successfully downloaded new GEO IP database to " + dataFile);
|
||||
logger.info("Successfully downloaded new GEO IP database to " + dataFile);
|
||||
startReading();
|
||||
} catch (IOException ioEx) {
|
||||
ConsoleLogger.logException("Could not download GeoLiteAPI database", ioEx);
|
||||
logger.logException("Could not download GeoLiteAPI database", ioEx);
|
||||
} finally {
|
||||
// clean up
|
||||
if (tempFile != null) {
|
||||
@@ -165,7 +167,7 @@ public class GeoIpService {
|
||||
|
||||
private void startReading() throws IOException {
|
||||
databaseReader = new Reader(dataFile.toFile(), FileMode.MEMORY, new CHMCache());
|
||||
ConsoleLogger.info(LICENSE);
|
||||
logger.info(LICENSE);
|
||||
|
||||
// clear downloading flag, because we now have working reader instance
|
||||
downloading = false;
|
||||
@@ -315,7 +317,7 @@ public class GeoIpService {
|
||||
// Ignore invalid ip addresses
|
||||
// Legacy GEO IP Database returned a unknown country object with Country-Code: '--' and Country-Name: 'N/A'
|
||||
} catch (IOException ioEx) {
|
||||
ConsoleLogger.logException("Cannot lookup country for " + ip + " at GEO IP database", ioEx);
|
||||
logger.logException("Cannot lookup country for " + ip + " at GEO IP database", ioEx);
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
|
||||
@@ -3,6 +3,7 @@ package fr.xephi.authme.service;
|
||||
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 fr.xephi.authme.security.HashAlgorithm;
|
||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import fr.xephi.authme.security.crypts.Sha256;
|
||||
@@ -15,6 +16,8 @@ import java.util.List;
|
||||
* Migrations to perform during the initialization of AuthMe.
|
||||
*/
|
||||
public final class MigrationService {
|
||||
|
||||
private static ConsoleLogger logger = ConsoleLoggerFactory.get(MigrationService.class);
|
||||
|
||||
private MigrationService() {
|
||||
}
|
||||
@@ -29,14 +32,14 @@ public final class MigrationService {
|
||||
public static void changePlainTextToSha256(Settings settings, DataSource dataSource,
|
||||
Sha256 authmeSha256) {
|
||||
if (HashAlgorithm.PLAINTEXT == settings.getProperty(SecuritySettings.PASSWORD_HASH)) {
|
||||
ConsoleLogger.warning("Your HashAlgorithm has been detected as plaintext and is now deprecated;"
|
||||
logger.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.warning("Don't stop your server; wait for the conversion to have been completed!");
|
||||
logger.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.warning("Skipping conversion for " + auth.getNickname() + "; detected SHA hash");
|
||||
logger.warning("Skipping conversion for " + auth.getNickname() + "; detected SHA hash");
|
||||
} else {
|
||||
HashedPassword hashedPassword = authmeSha256.computeHash(hash, auth.getNickname());
|
||||
auth.setPassword(hashedPassword);
|
||||
@@ -45,7 +48,7 @@ public final class MigrationService {
|
||||
}
|
||||
settings.setProperty(SecuritySettings.PASSWORD_HASH, HashAlgorithm.SHA256);
|
||||
settings.save();
|
||||
ConsoleLogger.info("Migrated " + allAuths.size() + " accounts from plaintext to SHA256");
|
||||
logger.info("Migrated " + allAuths.size() + " accounts from plaintext to SHA256");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.initialization.HasCleanup;
|
||||
import fr.xephi.authme.initialization.Reloadable;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.mail.EmailService;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.message.Messages;
|
||||
@@ -27,6 +28,8 @@ import static fr.xephi.authme.settings.properties.EmailSettings.RECOVERY_PASSWOR
|
||||
* Manager for password recovery.
|
||||
*/
|
||||
public class PasswordRecoveryService implements Reloadable, HasCleanup {
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(PasswordRecoveryService.class);
|
||||
|
||||
@Inject
|
||||
private CommonService commonService;
|
||||
@@ -95,7 +98,7 @@ public class PasswordRecoveryService implements Reloadable, HasCleanup {
|
||||
String thePass = RandomStringUtils.generate(commonService.getProperty(RECOVERY_PASSWORD_LENGTH));
|
||||
HashedPassword hashNew = passwordSecurity.computeHash(thePass, name);
|
||||
|
||||
ConsoleLogger.info("Generating new password for '" + name + "'");
|
||||
logger.info("Generating new password for '" + name + "'");
|
||||
|
||||
dataSource.updatePassword(name, hashNew);
|
||||
boolean couldSendMail = emailService.sendPasswordMail(name, email, thePass);
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.earth2me.essentials.Essentials;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -20,6 +21,7 @@ import java.io.File;
|
||||
@NoFieldScan
|
||||
public class PluginHookService {
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(PluginHookService.class);
|
||||
private final PluginManager pluginManager;
|
||||
private Essentials essentials;
|
||||
private Plugin cmi;
|
||||
@@ -182,11 +184,11 @@ public class PluginHookService {
|
||||
// Helpers
|
||||
// ------
|
||||
|
||||
private static <T extends Plugin> T getPlugin(PluginManager pluginManager, String name, Class<T> clazz)
|
||||
private <T extends Plugin> T getPlugin(PluginManager pluginManager, String name, Class<T> clazz)
|
||||
throws Exception, NoClassDefFoundError {
|
||||
if (pluginManager.isPluginEnabled(name)) {
|
||||
T plugin = clazz.cast(pluginManager.getPlugin(name));
|
||||
ConsoleLogger.info("Hooked successfully into " + name);
|
||||
logger.info("Hooked successfully into " + name);
|
||||
return plugin;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -5,6 +5,7 @@ import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.RestoreSessionEvent;
|
||||
import fr.xephi.authme.initialization.Reloadable;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import fr.xephi.authme.util.PlayerUtils;
|
||||
@@ -19,6 +20,7 @@ import static fr.xephi.authme.util.Utils.MILLIS_PER_MINUTE;
|
||||
*/
|
||||
public class SessionService implements Reloadable {
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(SessionService.class);
|
||||
private final CommonService service;
|
||||
private final BukkitService bukkitService;
|
||||
private final DataSource database;
|
||||
@@ -68,7 +70,7 @@ public class SessionService implements Reloadable {
|
||||
*/
|
||||
private SessionState fetchSessionStatus(PlayerAuth auth, Player player) {
|
||||
if (auth == null) {
|
||||
ConsoleLogger.warning("No PlayerAuth in database for '" + player.getName() + "' during session check");
|
||||
logger.warning("No PlayerAuth in database for '" + player.getName() + "' during session check");
|
||||
return SessionState.NOT_VALID;
|
||||
} else if (auth.getLastLogin() == null) {
|
||||
return SessionState.NOT_VALID;
|
||||
|
||||
@@ -10,6 +10,7 @@ import fr.xephi.authme.events.AuthMeTeleportEvent;
|
||||
import fr.xephi.authme.events.FirstSpawnTeleportEvent;
|
||||
import fr.xephi.authme.events.SpawnTeleportEvent;
|
||||
import fr.xephi.authme.initialization.Reloadable;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
@@ -28,6 +29,8 @@ import static fr.xephi.authme.settings.properties.RestrictionSettings.TELEPORT_U
|
||||
* Handles teleportation (placement of player to spawn).
|
||||
*/
|
||||
public class TeleportationService implements Reloadable {
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(TeleportationService.class);
|
||||
|
||||
@Inject
|
||||
private Settings settings;
|
||||
@@ -64,7 +67,7 @@ public class TeleportationService implements Reloadable {
|
||||
public void teleportOnJoin(final Player player) {
|
||||
if (!settings.getProperty(RestrictionSettings.NO_TELEPORT)
|
||||
&& settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
|
||||
ConsoleLogger.debug("Teleport on join for player `{0}`", player.getName());
|
||||
logger.debug("Teleport on join for player `{0}`", player.getName());
|
||||
teleportToSpawn(player, playerCache.isAuthenticated(player.getName()));
|
||||
}
|
||||
}
|
||||
@@ -88,7 +91,7 @@ public class TeleportationService implements Reloadable {
|
||||
return null;
|
||||
}
|
||||
|
||||
ConsoleLogger.debug("Returning custom location for >1.9 join event for player `{0}`", player.getName());
|
||||
logger.debug("Returning custom location for >1.9 join event for player `{0}`", player.getName());
|
||||
return location;
|
||||
}
|
||||
return null;
|
||||
@@ -110,7 +113,7 @@ public class TeleportationService implements Reloadable {
|
||||
}
|
||||
|
||||
if (!player.hasPlayedBefore() || !dataSource.isAuthAvailable(player.getName())) {
|
||||
ConsoleLogger.debug("Attempting to teleport player `{0}` to first spawn", player.getName());
|
||||
logger.debug("Attempting to teleport player `{0}` to first spawn", player.getName());
|
||||
performTeleportation(player, new FirstSpawnTeleportEvent(player, firstSpawn));
|
||||
}
|
||||
}
|
||||
@@ -134,15 +137,15 @@ public class TeleportationService implements Reloadable {
|
||||
|
||||
// The world in LimboPlayer is from where the player comes, before any teleportation by AuthMe
|
||||
if (mustForceSpawnAfterLogin(worldName)) {
|
||||
ConsoleLogger.debug("Teleporting `{0}` to spawn because of 'force-spawn after login'", player.getName());
|
||||
logger.debug("Teleporting `{0}` to spawn because of 'force-spawn after login'", player.getName());
|
||||
teleportToSpawn(player, true);
|
||||
} else if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
|
||||
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION) && auth.getQuitLocY() != 0) {
|
||||
Location location = buildLocationFromAuth(player, auth);
|
||||
ConsoleLogger.debug("Teleporting `{0}` after login, based on the player auth", player.getName());
|
||||
logger.debug("Teleporting `{0}` after login, based on the player auth", player.getName());
|
||||
teleportBackFromSpawn(player, location);
|
||||
} else if (limbo != null && limbo.getLocation() != null) {
|
||||
ConsoleLogger.debug("Teleporting `{0}` after login, based on the limbo player", player.getName());
|
||||
logger.debug("Teleporting `{0}` after login, based on the limbo player", player.getName());
|
||||
teleportBackFromSpawn(player, limbo.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.google.common.collect.Multimap;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.initialization.Reloadable;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||
@@ -33,6 +34,8 @@ import static fr.xephi.authme.util.StringUtils.isInsideString;
|
||||
* Validation service.
|
||||
*/
|
||||
public class ValidationService implements Reloadable {
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(ValidationService.class);
|
||||
|
||||
@Inject
|
||||
private Settings settings;
|
||||
@@ -125,7 +128,7 @@ public class ValidationService implements Reloadable {
|
||||
String countryCode = geoIpService.getCountryCode(hostAddress);
|
||||
boolean isCountryAllowed = validateWhitelistAndBlacklist(countryCode,
|
||||
ProtectionSettings.COUNTRIES_WHITELIST, ProtectionSettings.COUNTRIES_BLACKLIST);
|
||||
ConsoleLogger.debug("Country code `{0}` for `{1}` is allowed: {2}", countryCode, hostAddress, isCountryAllowed);
|
||||
logger.debug("Country code `{0}` for `{1}` is allowed: {2}", countryCode, hostAddress, isCountryAllowed);
|
||||
return isCountryAllowed;
|
||||
}
|
||||
|
||||
@@ -211,7 +214,7 @@ public class ValidationService implements Reloadable {
|
||||
String[] data = restriction.split(";");
|
||||
restrictions.put(data[0].toLowerCase(), data[1]);
|
||||
} else {
|
||||
ConsoleLogger.warning("Restricted user rule must have a ';' separating name from restriction,"
|
||||
logger.warning("Restricted user rule must have a ';' separating name from restriction,"
|
||||
+ " but found: '" + restriction + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.process.Management;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
@@ -18,6 +19,8 @@ import javax.inject.Inject;
|
||||
import java.util.Optional;
|
||||
|
||||
public class BungeeReceiver implements PluginMessageListener, SettingsDependent {
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(BungeeReceiver.class);
|
||||
|
||||
private final AuthMe plugin;
|
||||
private final BukkitService bukkitService;
|
||||
@@ -59,7 +62,7 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
final String typeId = dataIn.readUTF();
|
||||
final Optional<MessageType> type = MessageType.fromId(typeId);
|
||||
if (!type.isPresent()) {
|
||||
ConsoleLogger.debug("Received unsupported forwarded bungeecord message type! ({0})", typeId);
|
||||
logger.debug("Received unsupported forwarded bungeecord message type! ({0})", typeId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -68,7 +71,8 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
try {
|
||||
argument = dataIn.readUTF();
|
||||
} catch (IllegalStateException e) {
|
||||
ConsoleLogger.warning("Received invalid forwarded plugin message of type " + type.get().name() + ": argument is missing!");
|
||||
logger.warning("Received invalid forwarded plugin message of type " + type.get().name()
|
||||
+ ": argument is missing!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -92,7 +96,7 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
final String typeId = in.readUTF();
|
||||
final Optional<MessageType> type = MessageType.fromId(typeId);
|
||||
if (!type.isPresent()) {
|
||||
ConsoleLogger.debug("Received unsupported bungeecord message type! ({0})", typeId);
|
||||
logger.debug("Received unsupported bungeecord message type! ({0})", typeId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,7 +105,7 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
try {
|
||||
argument = in.readUTF();
|
||||
} catch (IllegalStateException e) {
|
||||
ConsoleLogger.warning("Received invalid plugin message of type " + type.get().name()
|
||||
logger.warning("Received invalid plugin message of type " + type.get().name()
|
||||
+ ": argument is missing!");
|
||||
return;
|
||||
}
|
||||
@@ -136,7 +140,7 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
Player player = bukkitService.getPlayerExact(name);
|
||||
if (player != null && player.isOnline()) {
|
||||
management.forceLogin(player);
|
||||
ConsoleLogger.info("The user " + player.getName() + " has been automatically logged in, "
|
||||
logger.info("The user " + player.getName() + " has been automatically logged in, "
|
||||
+ "as requested via plugin messaging.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
@@ -16,6 +17,7 @@ import javax.inject.Inject;
|
||||
|
||||
public class BungeeSender implements SettingsDependent {
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(BungeeSender.class);
|
||||
private final AuthMe plugin;
|
||||
private final BukkitService bukkitService;
|
||||
private final DataSource dataSource;
|
||||
@@ -97,7 +99,7 @@ public class BungeeSender implements SettingsDependent {
|
||||
public void sendAuthMeBungeecordMessage(final MessageType type, final String playerName) {
|
||||
if (isEnabled) {
|
||||
if (!plugin.isEnabled()) {
|
||||
ConsoleLogger.debug("Tried to send a " + type + " bungeecord message but the plugin was disabled!");
|
||||
logger.debug("Tried to send a " + type + " bungeecord message but the plugin was disabled!");
|
||||
return;
|
||||
}
|
||||
if (type.isRequiresCaching() && !dataSource.isCached()) {
|
||||
|
||||
Reference in New Issue
Block a user