class LastLoginCommand implements ExecutableCommand {

    @Override
    public void executeCommand(CommandSender sender, List<String> arguments) {
        // Get the player
        String playerName = arguments.isEmpty() ? sender.getName() : arguments.get(0);

        PlayerAuth auth = dataSource.getAuth(playerName);
        if (auth == null) {
            commonService.send(sender, MessageKey.UNKNOWN_USER);
            return;
        }

        // Get the last login date
        final Long lastLogin = auth.getLastLogin();
        final String lastLoginDate = lastLogin == null ? "never" : new Date(lastLogin).toString();

        // Show the player status
        sender.sendMessage("[AuthMe] " + playerName + " last login: " + lastLoginDate);
        if (lastLogin != null) {
            sender.sendMessage("[AuthMe] The player " + playerName + " last logged in "
                + createLastLoginIntervalMessage(lastLogin) + " ago");
        }
        sender.sendMessage("[AuthMe] Last player's IP: " + auth.getLastIp());
    }

}