mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-25 18:17:34 +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.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
import fr.xephi.authme.util.BukkitService;
|
import fr.xephi.authme.util.BukkitService;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
||||||
public class BungeeCordMessage implements PluginMessageListener {
|
public class BungeeCordMessage implements PluginMessageListener {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@ -26,9 +24,6 @@ public class BungeeCordMessage implements PluginMessageListener {
|
|||||||
@Inject
|
@Inject
|
||||||
private PlayerCache playerCache;
|
private PlayerCache playerCache;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Settings settings;
|
|
||||||
|
|
||||||
BungeeCordMessage() { }
|
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
|
// Important: the single session feature works if we use the low priority to the sync handler
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@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) {
|
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (validationService.isUnrestricted(player.getName())) {
|
if (validationService.isUnrestricted(player.getName())) {
|
||||||
@ -221,7 +239,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Fast stuff
|
// Fast stuff
|
||||||
onJoinVerifier.checkSingleSession(lowerName);
|
// onJoinVerifier.checkSingleSession(lowerName);
|
||||||
onJoinVerifier.checkIsValidName(name);
|
onJoinVerifier.checkIsValidName(name);
|
||||||
|
|
||||||
// Get the auth later as this may cause the single session check to fail
|
// Get the auth later as this may cause the single session check to fail
|
||||||
|
Loading…
Reference in New Issue
Block a user