@EventHandler
    public void onPlayerPreLoginEvent(AsyncPlayerPreLoginEvent event) {
        String playerName = event.getName();

        // check if there is a ban...
        Ban ban = plugin.getController().getBan(playerName);

        // player is still banned, but he should already be unbanned
        if (ban != null && Calendar.getInstance().after(ban.getUntil())) {
            TimeBanUnbanEvent unbanEvent = new TimeBanUnbanEvent(ban);
            Bukkit.getServer().getPluginManager().callEvent(unbanEvent);

            // player is banned...
        } else if (ban != null && Calendar.getInstance().before(ban.getUntil())) {
            HashMap<String, String> values = new HashMap<String, String>(2);
            values.put("{until}", ban.getUntil().getTime().toString());
            values.put("{reason}", ban.getReason());

            String banMessage = MessagesUtil.formatMessage("banned_player_login", values);
            event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, banMessage);
        }
    }