use of fr.xephi.authme.events.RestoreSessionEvent in project AuthMeReloaded by AuthMe.
the class AsynchronousJoin method canResumeSession.
private boolean canResumeSession(Player player) {
final String name = player.getName();
if (sessionManager.hasSession(name) || database.isLogged(name)) {
PlayerAuth auth = database.getAuth(name);
database.setUnlogged(name);
playerCache.removePlayer(name);
if (auth != null) {
if (auth.getIp().equals(PlayerUtils.getPlayerIp(player))) {
RestoreSessionEvent event = bukkitService.createAndCallEvent(isAsync -> new RestoreSessionEvent(player, isAsync));
return !event.isCancelled();
} else {
service.send(player, MessageKey.SESSION_EXPIRED);
}
}
}
return false;
}
Aggregations