This commit is contained in:
Gabriele C 2016-08-02 14:29:41 +02:00
parent b8d2d61ec5
commit 1b9c23e52d
2 changed files with 19 additions and 6 deletions

View File

@ -7,14 +7,12 @@ import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.util.BukkitService;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import javax.inject.Inject;
public class BungeeCordMessage implements PluginMessageListener {
@Inject
@ -25,9 +23,6 @@ public class BungeeCordMessage implements PluginMessageListener {
@Inject
private PlayerCache playerCache;
@Inject
private Settings settings;
BungeeCordMessage() { }

View File

@ -206,6 +206,24 @@ public class AuthMePlayerListener implements Listener {
// Important: the single session feature works if we use the low priority to the sync handler
@EventHandler(priority = EventPriority.LOWEST)
public void onLoginSingleSession(PlayerLoginEvent event) {
if(event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
return;
}
final Player player = event.getPlayer();
final String name = player.getName();
try {
onJoinVerifier.checkSingleSession(name);
} catch (FailedVerificationException e) {
event.setKickMessage(m.retrieveSingle(e.getReason(), e.getArgs()));
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
return;
}
}
@EventHandler(priority = EventPriority.LOW)
public void onPlayerLogin(PlayerLoginEvent event) {
final Player player = event.getPlayer();
if (validationService.isUnrestricted(player.getName())) {
@ -221,7 +239,7 @@ public class AuthMePlayerListener implements Listener {
try {
// Fast stuff
onJoinVerifier.checkSingleSession(lowerName);
// onJoinVerifier.checkSingleSession(lowerName);
onJoinVerifier.checkIsValidName(name);
// Get the auth later as this may cause the single session check to fail