This commit is contained in:
Gabriele C
2017-11-02 11:24:17 +01:00
parent 6505538240
commit 273c318e96
22 changed files with 105 additions and 118 deletions
@@ -6,10 +6,11 @@ import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.service.bungeecord.MessageType;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -53,7 +54,7 @@ public class AsyncChangePassword implements AsynchronousProcess {
commonService.send(player, MessageKey.ERROR);
return;
}
bungeeService.sendRefreshPassword(name);
bungeeService.sendAuthMeBungeecordMessage(MessageType.REFRESH_PASSWORD, name);
playerCache.updatePlayer(auth);
commonService.send(player, MessageKey.PASSWORD_CHANGED_SUCCESS);
@@ -83,7 +84,7 @@ public class AsyncChangePassword implements AsynchronousProcess {
HashedPassword hashedPassword = passwordSecurity.computeHash(newPassword, lowerCaseName);
if (dataSource.updatePassword(lowerCaseName, hashedPassword)) {
bungeeService.sendRefreshPassword(lowerCaseName);
bungeeService.sendAuthMeBungeecordMessage(MessageType.REFRESH_PASSWORD, lowerCaseName);
if (sender != null) {
commonService.send(sender, MessageKey.PASSWORD_CHANGED_SUCCESS);
ConsoleLogger.info(sender.getName() + " changed password of " + lowerCaseName);
@@ -6,9 +6,10 @@ import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.ValidationService;
import fr.xephi.authme.service.bungeecord.MessageType;
import fr.xephi.authme.util.Utils;
import org.bukkit.entity.Player;
@@ -59,7 +60,7 @@ public class AsyncAddEmail implements AsynchronousProcess {
auth.setEmail(email);
if (dataSource.updateEmail(auth)) {
playerCache.updatePlayer(auth);
bungeeService.sendRefreshEmail(playerName);
bungeeService.sendAuthMeBungeecordMessage(MessageType.REFRESH_EMAIL, playerName);
service.send(player, MessageKey.EMAIL_ADDED_SUCCESS);
} else {
ConsoleLogger.warning("Could not save email for player '" + player + "'");
@@ -5,9 +5,10 @@ import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.ValidationService;
import fr.xephi.authme.service.bungeecord.MessageType;
import org.bukkit.entity.Player;
import javax.inject.Inject;
@@ -67,7 +68,7 @@ public class AsyncChangeEmail implements AsynchronousProcess {
auth.setEmail(newEmail);
if (dataSource.updateEmail(auth)) {
playerCache.updatePlayer(auth);
bungeeService.sendRefreshEmail(player.getName());
bungeeService.sendAuthMeBungeecordMessage(MessageType.REFRESH_EMAIL, player.getName());
service.send(player, MessageKey.EMAIL_CHANGED_SUCCESS);
} else {
service.send(player, MessageKey.ERROR);
@@ -19,9 +19,10 @@ import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.SyncProcessManager;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.SessionService;
import fr.xephi.authme.service.bungeecord.MessageType;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.settings.properties.EmailSettings;
import fr.xephi.authme.settings.properties.HooksSettings;
@@ -225,7 +226,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
auth.setLastLogin(System.currentTimeMillis());
auth.setLastIp(ip);
dataSource.updateSession(auth);
bungeeService.sendRefreshSession(player.getName());
bungeeService.sendAuthMeBungeecordMessage(MessageType.REFRESH_SESSION, player.getName());
// Successful login, so reset the captcha & temp ban count
final String name = player.getName();
@@ -251,7 +252,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
playerCache.updatePlayer(auth);
dataSource.setLogged(name);
sessionService.grantSession(name);
bungeeService.sendLogin(name);
bungeeService.sendAuthMeBungeecordMessage(MessageType.LOGIN, name);
// As the scheduling executes the Task most likely after the current
// task, we schedule it in the end
@@ -8,7 +8,7 @@ import fr.xephi.authme.events.LoginEvent;
import fr.xephi.authme.events.RestoreInventoryEvent;
import fr.xephi.authme.process.SynchronousProcess;
import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.JoinMessageService;
import fr.xephi.authme.service.TeleportationService;
@@ -7,9 +7,10 @@ import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.SyncProcessManager;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.SessionService;
import fr.xephi.authme.service.bungeecord.MessageType;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import org.bukkit.entity.Player;
@@ -58,18 +59,18 @@ public class AsynchronousLogout implements AsynchronousProcess {
PlayerAuth auth = playerCache.getAuth(name);
database.updateSession(auth);
bungeeService.sendRefreshSession(name);
bungeeService.sendAuthMeBungeecordMessage(MessageType.REFRESH_SESSION, name);
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
auth.setQuitLocation(player.getLocation());
database.updateQuitLoc(auth);
bungeeService.sendRefreshQuitLoc(name);
bungeeService.sendAuthMeBungeecordMessage(MessageType.REFRESH_QUITLOC, name);
}
playerCache.removePlayer(name);
codeManager.unverify(name);
database.setUnlogged(name);
sessionService.revokeSession(name);
bungeeService.sendLogout(name);
bungeeService.sendAuthMeBungeecordMessage(MessageType.LOGOUT, name);
syncProcessManager.processSyncPlayerLogout(player);
}
}
@@ -7,10 +7,11 @@ import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.CacheDataSource;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.process.SyncProcessManager;
import fr.xephi.authme.service.SessionService;
import fr.xephi.authme.service.bungeecord.MessageType;
import fr.xephi.authme.settings.SpawnLoader;
import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
@@ -78,7 +79,6 @@ public class AsynchronousQuit implements AsynchronousProcess {
.name(name).location(loc)
.realName(player.getName()).build();
database.updateQuitLoc(auth);
bungeeService.sendRefreshQuitLoc(name);
}
final String ip = PlayerUtils.getPlayerIp(player);
@@ -89,7 +89,7 @@ public class AsynchronousQuit implements AsynchronousProcess {
.lastLogin(System.currentTimeMillis())
.build();
database.updateSession(auth);
bungeeService.sendRefreshSession(name);
bungeeService.sendAuthMeBungeecordMessage(MessageType.REFRESH_QUITLOC, name);
}
//always unauthenticate the player - use session only for auto logins on the same ip
@@ -10,8 +10,9 @@ import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.register.executors.RegistrationExecutor;
import fr.xephi.authme.process.register.executors.RegistrationParameters;
import fr.xephi.authme.process.register.executors.RegistrationMethod;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.bungeecord.MessageType;
import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.util.PlayerUtils;
@@ -87,7 +88,7 @@ public class AsyncRegister implements AsynchronousProcess {
PlayerAuth auth = executor.buildPlayerAuth(parameters);
if (database.saveAuth(auth)) {
executor.executePostPersistAction(parameters);
bungeeService.sendRegister(parameters.getPlayerName());
bungeeService.sendAuthMeBungeecordMessage(MessageType.REGISTER, parameters.getPlayerName());
} else {
service.send(parameters.getPlayer(), MessageKey.ERROR);
}
@@ -4,7 +4,7 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.data.limbo.LimboService;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.SynchronousProcess;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.settings.commandconfig.CommandManager;
import fr.xephi.authme.settings.properties.EmailSettings;
@@ -11,9 +11,10 @@ import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.TeleportationService;
import fr.xephi.authme.service.bungeecord.MessageType;
import fr.xephi.authme.settings.commandconfig.CommandManager;
import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
@@ -108,7 +109,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
private void performUnregister(String name, Player player) {
playerCache.removePlayer(name);
bungeeService.sendUnregister(name);
bungeeService.sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
if (player == null || !player.isOnline()) {
return;