mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-26 04:05:28 +01:00
Remove cache-update bungee messages, always use the player in the context to send bungee messages, minor codestyle changes
This commit is contained in:
parent
fd0a0a1155
commit
7c8bbe6294
@ -5,8 +5,6 @@ import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -23,18 +21,15 @@ public class PurgeLastPositionCommand implements ExecutableCommand {
|
||||
@Inject
|
||||
private CommonService commonService;
|
||||
|
||||
@Inject
|
||||
private BungeeSender bungeeSender;
|
||||
|
||||
@Override
|
||||
public void executeCommand(final CommandSender sender, List<String> arguments) {
|
||||
public void executeCommand(CommandSender sender, List<String> arguments) {
|
||||
String playerName = arguments.isEmpty() ? sender.getName() : arguments.get(0);
|
||||
|
||||
if ("*".equals(playerName)) {
|
||||
for (PlayerAuth auth : dataSource.getAllAuths()) {
|
||||
resetLastPosition(auth);
|
||||
dataSource.updateQuitLoc(auth);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_QUITLOC, playerName);
|
||||
// TODO: send an update when a messaging service will be implemented (QUITLOC)
|
||||
}
|
||||
sender.sendMessage("All players last position locations are now reset");
|
||||
} else {
|
||||
@ -47,7 +42,7 @@ public class PurgeLastPositionCommand implements ExecutableCommand {
|
||||
|
||||
resetLastPosition(auth);
|
||||
dataSource.updateQuitLoc(auth);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_QUITLOC, playerName);
|
||||
// TODO: send an update when a messaging service will be implemented (QUITLOC)
|
||||
sender.sendMessage(playerName + "'s last position location is now reset");
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ import fr.xephi.authme.data.limbo.LimboService;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
@ -36,8 +34,6 @@ public class OnShutdownPlayerSaver {
|
||||
private PlayerCache playerCache;
|
||||
@Inject
|
||||
private LimboService limboService;
|
||||
@Inject
|
||||
private BungeeSender bungeeSender;
|
||||
|
||||
OnShutdownPlayerSaver() {
|
||||
}
|
||||
@ -52,7 +48,7 @@ public class OnShutdownPlayerSaver {
|
||||
}
|
||||
|
||||
private void savePlayer(Player player) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase();
|
||||
if (PlayerUtils.isNpc(player) || validationService.isUnrestricted(name)) {
|
||||
return;
|
||||
}
|
||||
@ -67,12 +63,12 @@ public class OnShutdownPlayerSaver {
|
||||
private void saveLoggedinPlayer(Player player) {
|
||||
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
|
||||
Location loc = spawnLoader.getPlayerLocationOrSpawn(player);
|
||||
final PlayerAuth auth = PlayerAuth.builder()
|
||||
PlayerAuth auth = PlayerAuth.builder()
|
||||
.name(player.getName().toLowerCase())
|
||||
.realName(player.getName())
|
||||
.location(loc).build();
|
||||
dataSource.updateQuitLoc(auth);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_QUITLOC, player.getName());
|
||||
// TODO: send an update when a messaging service will be implemented (QUITLOC)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,6 @@ import fr.xephi.authme.process.AsynchronousProcess;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -33,9 +31,6 @@ public class AsyncChangePassword implements AsynchronousProcess {
|
||||
@Inject
|
||||
private PlayerCache playerCache;
|
||||
|
||||
@Inject
|
||||
private BungeeSender bungeeSender;
|
||||
|
||||
AsyncChangePassword() {
|
||||
}
|
||||
|
||||
@ -46,8 +41,8 @@ public class AsyncChangePassword implements AsynchronousProcess {
|
||||
* @param oldPassword the old password used by the player
|
||||
* @param newPassword the new password chosen by the player
|
||||
*/
|
||||
public void changePassword(final Player player, String oldPassword, String newPassword) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
public void changePassword(Player player, String oldPassword, String newPassword) {
|
||||
String name = player.getName().toLowerCase();
|
||||
PlayerAuth auth = playerCache.getAuth(name);
|
||||
if (passwordSecurity.comparePassword(oldPassword, auth.getPassword(), player.getName())) {
|
||||
HashedPassword hashedPassword = passwordSecurity.computeHash(newPassword, name);
|
||||
@ -57,7 +52,8 @@ public class AsyncChangePassword implements AsynchronousProcess {
|
||||
commonService.send(player, MessageKey.ERROR);
|
||||
return;
|
||||
}
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_PASSWORD, name);
|
||||
|
||||
// TODO: send an update when a messaging service will be implemented (PASSWORD_CHANGED)
|
||||
|
||||
playerCache.updatePlayer(auth);
|
||||
commonService.send(player, MessageKey.PASSWORD_CHANGED_SUCCESS);
|
||||
@ -74,8 +70,8 @@ public class AsyncChangePassword implements AsynchronousProcess {
|
||||
* @param playerName the player name
|
||||
* @param newPassword the new password chosen for the player
|
||||
*/
|
||||
public void changePasswordAsAdmin(CommandSender sender, final String playerName, String newPassword) {
|
||||
final String lowerCaseName = playerName.toLowerCase();
|
||||
public void changePasswordAsAdmin(CommandSender sender, String playerName, String newPassword) {
|
||||
String lowerCaseName = playerName.toLowerCase();
|
||||
if (!(playerCache.isAuthenticated(lowerCaseName) || dataSource.isAuthAvailable(lowerCaseName))) {
|
||||
if (sender == null) {
|
||||
logger.warning("Tried to change password for user " + lowerCaseName + " but it doesn't exist!");
|
||||
@ -87,7 +83,8 @@ public class AsyncChangePassword implements AsynchronousProcess {
|
||||
|
||||
HashedPassword hashedPassword = passwordSecurity.computeHash(newPassword, lowerCaseName);
|
||||
if (dataSource.updatePassword(lowerCaseName, hashedPassword)) {
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_PASSWORD, lowerCaseName);
|
||||
// TODO: send an update when a messaging service will be implemented (PASSWORD_CHANGED)
|
||||
|
||||
if (sender != null) {
|
||||
commonService.send(sender, MessageKey.PASSWORD_CHANGED_SUCCESS);
|
||||
logger.info(sender.getName() + " changed password of " + lowerCaseName);
|
||||
|
@ -11,8 +11,6 @@ import fr.xephi.authme.process.AsynchronousProcess;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -37,9 +35,6 @@ public class AsyncAddEmail implements AsynchronousProcess {
|
||||
@Inject
|
||||
private ValidationService validationService;
|
||||
|
||||
@Inject
|
||||
private BungeeSender bungeeSender;
|
||||
|
||||
@Inject
|
||||
private BukkitService bukkitService;
|
||||
|
||||
@ -57,7 +52,7 @@ public class AsyncAddEmail implements AsynchronousProcess {
|
||||
|
||||
if (playerCache.isAuthenticated(playerName)) {
|
||||
PlayerAuth auth = playerCache.getAuth(playerName);
|
||||
final String currentEmail = auth.getEmail();
|
||||
String currentEmail = auth.getEmail();
|
||||
|
||||
if (!Utils.isEmailEmpty(currentEmail)) {
|
||||
service.send(player, MessageKey.USAGE_CHANGE_EMAIL);
|
||||
@ -76,7 +71,7 @@ public class AsyncAddEmail implements AsynchronousProcess {
|
||||
auth.setEmail(email);
|
||||
if (dataSource.updateEmail(auth)) {
|
||||
playerCache.updatePlayer(auth);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_EMAIL, playerName);
|
||||
// TODO: send an update when a messaging service will be implemented (ADD_MAIL)
|
||||
service.send(player, MessageKey.EMAIL_ADDED_SUCCESS);
|
||||
} else {
|
||||
logger.warning("Could not save email for player '" + player + "'");
|
||||
|
@ -11,8 +11,6 @@ import fr.xephi.authme.process.AsynchronousProcess;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -36,9 +34,6 @@ public class AsyncChangeEmail implements AsynchronousProcess {
|
||||
@Inject
|
||||
private ValidationService validationService;
|
||||
|
||||
@Inject
|
||||
private BungeeSender bungeeSender;
|
||||
|
||||
@Inject
|
||||
private BukkitService bukkitService;
|
||||
|
||||
@ -56,7 +51,7 @@ public class AsyncChangeEmail implements AsynchronousProcess {
|
||||
String playerName = player.getName().toLowerCase();
|
||||
if (playerCache.isAuthenticated(playerName)) {
|
||||
PlayerAuth auth = playerCache.getAuth(playerName);
|
||||
final String currentEmail = auth.getEmail();
|
||||
String currentEmail = auth.getEmail();
|
||||
|
||||
if (currentEmail == null) {
|
||||
service.send(player, MessageKey.USAGE_ADD_EMAIL);
|
||||
@ -94,7 +89,7 @@ public class AsyncChangeEmail implements AsynchronousProcess {
|
||||
auth.setEmail(newEmail);
|
||||
if (dataSource.updateEmail(auth)) {
|
||||
playerCache.updatePlayer(auth);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_EMAIL, player.getName());
|
||||
// TODO: send an update when a messaging service will be implemented (CHANGE_MAIL)
|
||||
service.send(player, MessageKey.EMAIL_CHANGED_SUCCESS);
|
||||
} else {
|
||||
service.send(player, MessageKey.ERROR);
|
||||
|
@ -89,9 +89,9 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
*
|
||||
* @param player the player to process
|
||||
*/
|
||||
public void processJoin(final Player player) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
final String ip = PlayerUtils.getPlayerIp(player);
|
||||
public void processJoin(Player player) {
|
||||
String name = player.getName().toLowerCase();
|
||||
String ip = PlayerUtils.getPlayerIp(player);
|
||||
|
||||
if (!validationService.fulfillsNameRestrictions(player)) {
|
||||
handlePlayerWithUnmetNameRestriction(player, ip);
|
||||
@ -116,7 +116,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean isAuthAvailable = database.isAuthAvailable(name);
|
||||
boolean isAuthAvailable = database.isAuthAvailable(name);
|
||||
|
||||
if (isAuthAvailable) {
|
||||
// Protect inventory
|
||||
@ -153,7 +153,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
});
|
||||
|
||||
// Skip if registration is optional
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.LOGIN, name);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(player, MessageType.LOGIN);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
* @param isAuthAvailable true if the player is registered, false otherwise
|
||||
*/
|
||||
private void processJoinSync(Player player, boolean isAuthAvailable) {
|
||||
final int registrationTimeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND;
|
||||
int registrationTimeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND;
|
||||
|
||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
|
||||
limboService.createLimboPlayer(player, isAuthAvailable);
|
||||
@ -204,7 +204,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
*
|
||||
* @return true if the verification is OK (no infraction), false if player has been kicked
|
||||
*/
|
||||
private boolean validatePlayerCountForIp(final Player player, String ip) {
|
||||
private boolean validatePlayerCountForIp(Player player, String ip) {
|
||||
if (service.getProperty(RestrictionSettings.MAX_JOIN_PER_IP) > 0
|
||||
&& !service.hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)
|
||||
&& !InternetProtocolUtils.isLoopbackAddress(ip)
|
||||
|
@ -153,7 +153,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
* (e.g. because he is already logged in)
|
||||
*/
|
||||
private PlayerAuth getPlayerAuth(Player player, boolean quiet) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase();
|
||||
if (playerCache.isAuthenticated(name)) {
|
||||
if (!quiet) {
|
||||
service.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
|
||||
@ -179,7 +179,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String ip = PlayerUtils.getPlayerIp(player);
|
||||
String ip = PlayerUtils.getPlayerIp(player);
|
||||
if (hasReachedMaxLoggedInPlayersForIp(player, ip)) {
|
||||
if (!quiet) {
|
||||
service.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
|
||||
@ -206,7 +206,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
* false otherwise
|
||||
*/
|
||||
private boolean checkPlayerInfo(Player player, PlayerAuth auth, String password) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
// If captcha is required send a message to the player and deny to log in
|
||||
if (loginCaptchaManager.isCaptchaRequired(name)) {
|
||||
@ -214,7 +214,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String ip = PlayerUtils.getPlayerIp(player);
|
||||
String ip = PlayerUtils.getPlayerIp(player);
|
||||
|
||||
// Increase the counts here before knowing the result of the login.
|
||||
loginCaptchaManager.increaseLoginFailureCount(name);
|
||||
@ -266,18 +266,19 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
*/
|
||||
public void performLogin(Player player, PlayerAuth auth) {
|
||||
if (player.isOnline()) {
|
||||
final boolean isFirstLogin = (auth.getLastLogin() == null);
|
||||
boolean isFirstLogin = (auth.getLastLogin() == null);
|
||||
|
||||
// Update auth to reflect this new login
|
||||
final String ip = PlayerUtils.getPlayerIp(player);
|
||||
String ip = PlayerUtils.getPlayerIp(player);
|
||||
auth.setRealName(player.getName());
|
||||
auth.setLastLogin(System.currentTimeMillis());
|
||||
auth.setLastIp(ip);
|
||||
dataSource.updateSession(auth);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_SESSION, player.getName());
|
||||
|
||||
// TODO: send an update when a messaging service will be implemented (SESSION)
|
||||
|
||||
// Successful login, so reset the captcha & temp ban count
|
||||
final String name = player.getName();
|
||||
String name = player.getName();
|
||||
loginCaptchaManager.resetLoginFailureCount(name);
|
||||
tempbanManager.resetCount(ip, name);
|
||||
player.setNoDamageTicks(0);
|
||||
@ -288,7 +289,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
List<String> auths = dataSource.getAllAuthsByIp(auth.getLastIp());
|
||||
displayOtherAccounts(auths, player);
|
||||
|
||||
final String email = auth.getEmail();
|
||||
String email = auth.getEmail();
|
||||
if (service.getProperty(EmailSettings.RECALL_PLAYERS) && Utils.isEmailEmpty(email)) {
|
||||
service.send(player, MessageKey.ADD_EMAIL_MESSAGE);
|
||||
}
|
||||
@ -299,7 +300,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
playerCache.updatePlayer(auth);
|
||||
dataSource.setLogged(name);
|
||||
sessionService.grantSession(name);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.LOGIN, name);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(player, MessageType.LOGIN);
|
||||
|
||||
// As the scheduling executes the Task most likely after the current
|
||||
// task, we schedule it in the end
|
||||
@ -368,7 +369,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
}
|
||||
|
||||
// Count logged in players with same IP address
|
||||
final String name = player.getName();
|
||||
String name = player.getName();
|
||||
int count = 0;
|
||||
for (Player onlinePlayer : bukkitService.getOnlinePlayers()) {
|
||||
if (ip.equalsIgnoreCase(PlayerUtils.getPlayerIp(onlinePlayer))
|
||||
|
@ -51,7 +51,7 @@ public class AsynchronousLogout implements AsynchronousProcess {
|
||||
* @param player the player wanting to log out
|
||||
*/
|
||||
public void logout(Player player) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase();
|
||||
if (!playerCache.isAuthenticated(name)) {
|
||||
service.send(player, MessageKey.NOT_LOGGED_IN);
|
||||
return;
|
||||
@ -59,18 +59,18 @@ public class AsynchronousLogout implements AsynchronousProcess {
|
||||
|
||||
PlayerAuth auth = playerCache.getAuth(name);
|
||||
database.updateSession(auth);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_SESSION, name);
|
||||
// TODO: send an update when a messaging service will be implemented (SESSION)
|
||||
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
|
||||
auth.setQuitLocation(player.getLocation());
|
||||
database.updateQuitLoc(auth);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_QUITLOC, name);
|
||||
// TODO: send an update when a messaging service will be implemented (QUITLOC)
|
||||
}
|
||||
|
||||
playerCache.removePlayer(name);
|
||||
codeManager.unverify(name);
|
||||
database.setUnlogged(name);
|
||||
sessionService.revokeSession(name);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.LOGOUT, name);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(player, MessageType.LOGOUT);
|
||||
syncProcessManager.processSyncPlayerLogout(player);
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,6 @@ import fr.xephi.authme.process.SyncProcessManager;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.SessionService;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
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;
|
||||
@ -53,9 +51,6 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
@Inject
|
||||
private SessionService sessionService;
|
||||
|
||||
@Inject
|
||||
private BungeeSender bungeeSender;
|
||||
|
||||
AsynchronousQuit() {
|
||||
}
|
||||
|
||||
@ -68,8 +63,8 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
if (player == null || validationService.isUnrestricted(player.getName())) {
|
||||
return;
|
||||
}
|
||||
final String name = player.getName().toLowerCase();
|
||||
final boolean wasLoggedIn = playerCache.isAuthenticated(name);
|
||||
String name = player.getName().toLowerCase();
|
||||
boolean wasLoggedIn = playerCache.isAuthenticated(name);
|
||||
|
||||
if (wasLoggedIn) {
|
||||
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
|
||||
@ -80,7 +75,7 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
database.updateQuitLoc(auth);
|
||||
}
|
||||
|
||||
final String ip = PlayerUtils.getPlayerIp(player);
|
||||
String ip = PlayerUtils.getPlayerIp(player);
|
||||
PlayerAuth auth = PlayerAuth.builder()
|
||||
.name(name)
|
||||
.realName(player.getName())
|
||||
@ -88,7 +83,8 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
.lastLogin(System.currentTimeMillis())
|
||||
.build();
|
||||
database.updateSession(auth);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_QUITLOC, name);
|
||||
|
||||
// TODO: send an update when a messaging service will be implemented (QUITLOC)
|
||||
}
|
||||
|
||||
//always unauthenticate the player - use session only for auto logins on the same ip
|
||||
|
@ -12,8 +12,6 @@ import fr.xephi.authme.process.register.executors.RegistrationMethod;
|
||||
import fr.xephi.authme.process.register.executors.RegistrationParameters;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
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.InternetProtocolUtils;
|
||||
@ -40,8 +38,6 @@ public class AsyncRegister implements AsynchronousProcess {
|
||||
private CommonService service;
|
||||
@Inject
|
||||
private SingletonStore<RegistrationExecutor> registrationExecutorFactory;
|
||||
@Inject
|
||||
private BungeeSender bungeeSender;
|
||||
|
||||
AsyncRegister() {
|
||||
}
|
||||
@ -71,7 +67,7 @@ public class AsyncRegister implements AsynchronousProcess {
|
||||
* @return true if the checks are successful and the event hasn't marked the action as denied, false otherwise.
|
||||
*/
|
||||
private boolean preRegisterCheck(RegistrationMethod<?> variant, Player player) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase();
|
||||
if (playerCache.isAuthenticated(name)) {
|
||||
service.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
|
||||
return false;
|
||||
@ -104,7 +100,6 @@ public class AsyncRegister implements AsynchronousProcess {
|
||||
PlayerAuth auth = executor.buildPlayerAuth(parameters);
|
||||
if (database.saveAuth(auth)) {
|
||||
executor.executePostPersistAction(parameters);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REGISTER, parameters.getPlayerName());
|
||||
} else {
|
||||
service.send(parameters.getPlayer(), MessageKey.ERROR);
|
||||
}
|
||||
@ -118,8 +113,8 @@ public class AsyncRegister implements AsynchronousProcess {
|
||||
* @return true if registration may take place, false otherwise (IP check failed)
|
||||
*/
|
||||
private boolean isPlayerIpAllowedToRegister(Player player) {
|
||||
final int maxRegPerIp = service.getProperty(RestrictionSettings.MAX_REGISTRATION_PER_IP);
|
||||
final String ip = PlayerUtils.getPlayerIp(player);
|
||||
int maxRegPerIp = service.getProperty(RestrictionSettings.MAX_REGISTRATION_PER_IP);
|
||||
String ip = PlayerUtils.getPlayerIp(player);
|
||||
if (maxRegPerIp > 0
|
||||
&& !InternetProtocolUtils.isLoopbackAddress(ip)
|
||||
&& !service.hasPermission(player, ALLOW_MULTIPLE_ACCOUNTS)) {
|
||||
|
@ -14,8 +14,6 @@ import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.TeleportationService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
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;
|
||||
@ -56,9 +54,6 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
||||
@Inject
|
||||
private CommandManager commandManager;
|
||||
|
||||
@Inject
|
||||
private BungeeSender bungeeSender;
|
||||
|
||||
AsynchronousUnregister() {
|
||||
}
|
||||
|
||||
@ -70,8 +65,8 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
||||
* @param password the input password to check before unregister
|
||||
*/
|
||||
public void unregister(Player player, String password) {
|
||||
final String name = player.getName();
|
||||
final PlayerAuth cachedAuth = playerCache.getAuth(name);
|
||||
String name = player.getName();
|
||||
PlayerAuth cachedAuth = playerCache.getAuth(name);
|
||||
if (passwordSecurity.comparePassword(password, cachedAuth.getPassword(), name)) {
|
||||
if (dataSource.removeAuth(name)) {
|
||||
performPostUnregisterActions(name, player);
|
||||
@ -118,7 +113,8 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
||||
*/
|
||||
private void performPostUnregisterActions(String name, Player player) {
|
||||
playerCache.removePlayer(name);
|
||||
bungeeSender.sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
|
||||
|
||||
// TODO: send an update when a messaging service will be implemented (UNREGISTER)
|
||||
|
||||
if (player == null || !player.isOnline()) {
|
||||
return;
|
||||
@ -137,7 +133,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
||||
service.send(player, MessageKey.UNREGISTERED_SUCCESS);
|
||||
}
|
||||
|
||||
private void applyBlindEffect(final Player player) {
|
||||
private void applyBlindEffect(Player player) {
|
||||
if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) {
|
||||
int timeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND;
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeout, 2));
|
||||
|
@ -1,6 +1,5 @@
|
||||
package fr.xephi.authme.service;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
@ -299,16 +298,14 @@ public class BukkitService implements SettingsDependent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the specified message to bungeecord using the first available player connection.
|
||||
* Send the specified bytes to bungeecord using the specified player connection.
|
||||
*
|
||||
* @param player the player
|
||||
* @param bytes the message
|
||||
*/
|
||||
public void sendBungeeMessage(byte[] bytes) {
|
||||
Player player = Iterables.getFirst(getOnlinePlayers(), null);
|
||||
if (player != null) {
|
||||
public void sendBungeeMessage(Player player, byte[] bytes) {
|
||||
player.sendPluginMessage(authMe, "BungeeCord", bytes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a ban to the this list. If a previous ban exists, this will
|
||||
|
@ -5,7 +5,6 @@ import com.google.common.io.ByteStreams;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.data.ProxySessionManager;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.process.Management;
|
||||
@ -27,29 +26,27 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
private final BukkitService bukkitService;
|
||||
private final ProxySessionManager proxySessionManager;
|
||||
private final Management management;
|
||||
private final DataSource dataSource;
|
||||
|
||||
private boolean isEnabled;
|
||||
|
||||
@Inject
|
||||
BungeeReceiver(AuthMe plugin, BukkitService bukkitService, ProxySessionManager proxySessionManager,
|
||||
Management management, DataSource dataSource, Settings settings) {
|
||||
Management management, Settings settings) {
|
||||
this.plugin = plugin;
|
||||
this.bukkitService = bukkitService;
|
||||
this.proxySessionManager = proxySessionManager;
|
||||
this.management = management;
|
||||
this.dataSource = dataSource;
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload(final Settings settings) {
|
||||
public void reload(Settings settings) {
|
||||
this.isEnabled = settings.getProperty(HooksSettings.BUNGEECORD);
|
||||
if (this.isEnabled) {
|
||||
this.isEnabled = bukkitService.isBungeeCordConfiguredForSpigot().orElse(false);
|
||||
}
|
||||
if (this.isEnabled) {
|
||||
final Messenger messenger = plugin.getServer().getMessenger();
|
||||
Messenger messenger = plugin.getServer().getMessenger();
|
||||
if (!messenger.isIncomingChannelRegistered(plugin, "BungeeCord")) {
|
||||
messenger.registerIncomingPluginChannel(plugin, "BungeeCord", this);
|
||||
}
|
||||
@ -61,23 +58,23 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
*
|
||||
* @param in the input to handle
|
||||
*/
|
||||
private void handleBroadcast(final ByteArrayDataInput in) {
|
||||
private void handleBroadcast(ByteArrayDataInput in) {
|
||||
// Read data byte array
|
||||
final short dataLength = in.readShort();
|
||||
final byte[] dataBytes = new byte[dataLength];
|
||||
short dataLength = in.readShort();
|
||||
byte[] dataBytes = new byte[dataLength];
|
||||
in.readFully(dataBytes);
|
||||
final ByteArrayDataInput dataIn = ByteStreams.newDataInput(dataBytes);
|
||||
ByteArrayDataInput dataIn = ByteStreams.newDataInput(dataBytes);
|
||||
|
||||
// Parse type
|
||||
final String typeId = dataIn.readUTF();
|
||||
final Optional<MessageType> type = MessageType.fromId(typeId);
|
||||
String typeId = dataIn.readUTF();
|
||||
Optional<MessageType> type = MessageType.fromId(typeId);
|
||||
if (!type.isPresent()) {
|
||||
logger.debug("Received unsupported forwarded bungeecord message type! ({0})", typeId);
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse argument
|
||||
final String argument;
|
||||
String argument;
|
||||
try {
|
||||
argument = dataIn.readUTF();
|
||||
} catch (IllegalStateException e) {
|
||||
@ -88,14 +85,9 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
|
||||
// Handle type
|
||||
switch (type.get()) {
|
||||
case UNREGISTER:
|
||||
dataSource.invalidateCache(argument);
|
||||
break;
|
||||
case REFRESH_PASSWORD:
|
||||
case REFRESH_QUITLOC:
|
||||
case REFRESH_EMAIL:
|
||||
case REFRESH:
|
||||
dataSource.refreshCache(argument);
|
||||
case LOGIN:
|
||||
case LOGOUT:
|
||||
// TODO: unused
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@ -108,15 +100,15 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
*/
|
||||
private void handle(ByteArrayDataInput in) {
|
||||
// Parse type
|
||||
final String typeId = in.readUTF();
|
||||
final Optional<MessageType> type = MessageType.fromId(typeId);
|
||||
String typeId = in.readUTF();
|
||||
Optional<MessageType> type = MessageType.fromId(typeId);
|
||||
if (!type.isPresent()) {
|
||||
logger.debug("Received unsupported bungeecord message type! ({0})", typeId);
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse argument
|
||||
final String argument;
|
||||
String argument;
|
||||
try {
|
||||
argument = in.readUTF();
|
||||
} catch (IllegalStateException e) {
|
||||
@ -135,15 +127,15 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(final String channel, final Player player, final byte[] data) {
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] data) {
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
final ByteArrayDataInput in = ByteStreams.newDataInput(data);
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(data);
|
||||
|
||||
// Check subchannel
|
||||
final String subChannel = in.readUTF();
|
||||
String subChannel = in.readUTF();
|
||||
if ("AuthMe.v2.Broadcast".equals(subChannel)) {
|
||||
handleBroadcast(in);
|
||||
} else if ("AuthMe.v2".equals(subChannel)) {
|
||||
@ -151,7 +143,7 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
||||
}
|
||||
}
|
||||
|
||||
private void performLogin(final String name) {
|
||||
private void performLogin(String name) {
|
||||
Player player = bukkitService.getPlayerExact(name);
|
||||
if (player != null && player.isOnline()) {
|
||||
management.forceLogin(player, true);
|
||||
|
@ -4,7 +4,6 @@ import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
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;
|
||||
@ -20,7 +19,6 @@ 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;
|
||||
|
||||
private boolean isEnabled;
|
||||
private String destinationServerOnLogin;
|
||||
@ -29,21 +27,19 @@ public class BungeeSender implements SettingsDependent {
|
||||
* Constructor.
|
||||
*/
|
||||
@Inject
|
||||
BungeeSender(final AuthMe plugin, final BukkitService bukkitService, final DataSource dataSource,
|
||||
final Settings settings) {
|
||||
BungeeSender(AuthMe plugin, BukkitService bukkitService, Settings settings) {
|
||||
this.plugin = plugin;
|
||||
this.bukkitService = bukkitService;
|
||||
this.dataSource = dataSource;
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload(final Settings settings) {
|
||||
public void reload(Settings settings) {
|
||||
this.isEnabled = settings.getProperty(HooksSettings.BUNGEECORD);
|
||||
this.destinationServerOnLogin = settings.getProperty(HooksSettings.BUNGEECORD_SERVER);
|
||||
|
||||
if (this.isEnabled) {
|
||||
final Messenger messenger = plugin.getServer().getMessenger();
|
||||
Messenger messenger = plugin.getServer().getMessenger();
|
||||
if (!messenger.isOutgoingChannelRegistered(plugin, "BungeeCord")) {
|
||||
messenger.registerOutgoingPluginChannel(plugin, "BungeeCord");
|
||||
}
|
||||
@ -54,27 +50,27 @@ public class BungeeSender implements SettingsDependent {
|
||||
return isEnabled;
|
||||
}
|
||||
|
||||
private void sendBungeecordMessage(final String... data) {
|
||||
final ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
for (final String element : data) {
|
||||
private void sendBungeecordMessage(Player player, String... data) {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
for (String element : data) {
|
||||
out.writeUTF(element);
|
||||
}
|
||||
bukkitService.sendBungeeMessage(out.toByteArray());
|
||||
bukkitService.sendBungeeMessage(player, out.toByteArray());
|
||||
}
|
||||
|
||||
private void sendForwardedBungeecordMessage(final String subChannel, final String... data) {
|
||||
final ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
private void sendForwardedBungeecordMessage(Player player, String subChannel, String... data) {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Forward");
|
||||
out.writeUTF("ONLINE");
|
||||
out.writeUTF(subChannel);
|
||||
final ByteArrayDataOutput dataOut = ByteStreams.newDataOutput();
|
||||
for (final String element : data) {
|
||||
ByteArrayDataOutput dataOut = ByteStreams.newDataOutput();
|
||||
for (String element : data) {
|
||||
dataOut.writeUTF(element);
|
||||
}
|
||||
final byte[] dataBytes = dataOut.toByteArray();
|
||||
byte[] dataBytes = dataOut.toByteArray();
|
||||
out.writeShort(dataBytes.length);
|
||||
out.write(dataBytes);
|
||||
bukkitService.sendBungeeMessage(out.toByteArray());
|
||||
bukkitService.sendBungeeMessage(player, out.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,33 +79,32 @@ public class BungeeSender implements SettingsDependent {
|
||||
*
|
||||
* @param player The player to send.
|
||||
*/
|
||||
public void connectPlayerOnLogin(final Player player) {
|
||||
if (isEnabled && !destinationServerOnLogin.isEmpty()) {
|
||||
bukkitService.scheduleSyncDelayedTask(() ->
|
||||
sendBungeecordMessage("ConnectOther", player.getName(), destinationServerOnLogin), 5L);
|
||||
public void connectPlayerOnLogin(Player player) {
|
||||
if (!isEnabled || destinationServerOnLogin.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
bukkitService.scheduleSyncDelayedTask(() ->
|
||||
sendBungeecordMessage(player, "Connect", destinationServerOnLogin), 5L);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a message to the AuthMe plugin messaging channel, if enabled.
|
||||
*
|
||||
* @param player The player related to the message
|
||||
* @param type The message type, See {@link MessageType}
|
||||
* @param playerName the player related to the message
|
||||
*/
|
||||
public void sendAuthMeBungeecordMessage(final MessageType type, final String playerName) {
|
||||
if (isEnabled) {
|
||||
public void sendAuthMeBungeecordMessage(Player player, MessageType type) {
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
if (!plugin.isEnabled()) {
|
||||
logger.debug("Tried to send a " + type + " bungeecord message but the plugin was disabled!");
|
||||
return;
|
||||
}
|
||||
if (type.isRequiresCaching() && !dataSource.isCached()) {
|
||||
return;
|
||||
}
|
||||
if (type.isBroadcast()) {
|
||||
sendForwardedBungeecordMessage("AuthMe.v2.Broadcast", type.getId(), playerName.toLowerCase());
|
||||
sendForwardedBungeecordMessage(player, "AuthMe.v2.Broadcast", type.getId(), player.getName().toLowerCase());
|
||||
} else {
|
||||
sendBungeecordMessage("AuthMe.v2", type.getId(), playerName.toLowerCase());
|
||||
}
|
||||
sendBungeecordMessage(player, "AuthMe.v2", type.getId(), player.getName().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,29 +3,16 @@ package fr.xephi.authme.service.bungeecord;
|
||||
import java.util.Optional;
|
||||
|
||||
public enum MessageType {
|
||||
REFRESH_PASSWORD("refresh.password", true, true),
|
||||
REFRESH_SESSION("refresh.session", true, true),
|
||||
REFRESH_QUITLOC("refresh.quitloc", true, true),
|
||||
REFRESH_EMAIL("refresh.email", true, true),
|
||||
REFRESH("refresh", true, true),
|
||||
REGISTER("register", true),
|
||||
UNREGISTER("unregister", true),
|
||||
LOGIN("login", true),
|
||||
LOGOUT("logout", true),
|
||||
PERFORM_LOGIN("perform.login", false);
|
||||
|
||||
private final String id;
|
||||
private final boolean broadcast;
|
||||
private final boolean requiresCaching;
|
||||
|
||||
MessageType(final String id, final boolean broadcast, final boolean requiresCaching) {
|
||||
MessageType(String id, boolean broadcast) {
|
||||
this.id = id;
|
||||
this.broadcast = broadcast;
|
||||
this.requiresCaching = requiresCaching;
|
||||
}
|
||||
|
||||
MessageType(final String id, final boolean broadcast) {
|
||||
this(id, broadcast, false);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
@ -36,10 +23,6 @@ public enum MessageType {
|
||||
return broadcast;
|
||||
}
|
||||
|
||||
public boolean isRequiresCaching() {
|
||||
return requiresCaching;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the MessageType with the given ID.
|
||||
*
|
||||
@ -47,8 +30,8 @@ public enum MessageType {
|
||||
*
|
||||
* @return the MessageType with the given id, empty if invalid.
|
||||
*/
|
||||
public static Optional<MessageType> fromId(final String id) {
|
||||
for (final MessageType current : values()) {
|
||||
public static Optional<MessageType> fromId(String id) {
|
||||
for (MessageType current : values()) {
|
||||
if (current.getId().equals(id)) {
|
||||
return Optional.of(current);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.TeleportationService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
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;
|
||||
@ -128,7 +127,6 @@ public class AsynchronousUnregisterTest {
|
||||
verify(teleportationService).teleportOnJoin(player);
|
||||
verifyCalledUnregisterEventFor(player);
|
||||
verify(commandManager).runCommandsOnUnregister(player);
|
||||
verify(bungeeSender).sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
|
||||
verify(player).addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 21 * 20, 2));
|
||||
}
|
||||
|
||||
@ -161,7 +159,6 @@ public class AsynchronousUnregisterTest {
|
||||
verify(teleportationService).teleportOnJoin(player);
|
||||
verifyCalledUnregisterEventFor(player);
|
||||
verify(commandManager).runCommandsOnUnregister(player);
|
||||
verify(bungeeSender).sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
|
||||
verify(player, never()).addPotionEffect(any(PotionEffect.class));
|
||||
}
|
||||
|
||||
@ -191,7 +188,6 @@ public class AsynchronousUnregisterTest {
|
||||
verify(playerCache).removePlayer(name);
|
||||
verifyNoInteractions(teleportationService, limboService);
|
||||
verifyCalledUnregisterEventFor(player);
|
||||
verify(bungeeSender).sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
|
||||
verify(commandManager).runCommandsOnUnregister(player);
|
||||
}
|
||||
|
||||
@ -243,7 +239,6 @@ public class AsynchronousUnregisterTest {
|
||||
verify(playerCache).removePlayer(name);
|
||||
verifyNoInteractions(teleportationService);
|
||||
verifyCalledUnregisterEventFor(player);
|
||||
verify(bungeeSender).sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
|
||||
}
|
||||
|
||||
// Initiator known and Player object available
|
||||
@ -270,7 +265,6 @@ public class AsynchronousUnregisterTest {
|
||||
verify(teleportationService).teleportOnJoin(player);
|
||||
verifyCalledUnregisterEventFor(player);
|
||||
verify(commandManager).runCommandsOnUnregister(player);
|
||||
verify(bungeeSender).sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -287,7 +281,6 @@ public class AsynchronousUnregisterTest {
|
||||
verify(playerCache).removePlayer(name);
|
||||
verifyNoInteractions(teleportationService);
|
||||
verifyCalledUnregisterEventFor(null);
|
||||
verify(bungeeSender).sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user