mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-24 17:47:38 +01:00
Try to fix #831
This commit is contained in:
parent
b8d2d61ec5
commit
1b9c23e52d
@ -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() { }
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user