Search in sources :

Example 1 with RestoreSessionEvent

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;
}
Also used : RestoreSessionEvent(fr.xephi.authme.events.RestoreSessionEvent) PlayerAuth(fr.xephi.authme.data.auth.PlayerAuth)

Aggregations

PlayerAuth (fr.xephi.authme.data.auth.PlayerAuth)1 RestoreSessionEvent (fr.xephi.authme.events.RestoreSessionEvent)1