Converting CompletableFuture

i have an User Class and i want to retreive from CompletableFuture<Optional>

        CompletableFuture<Optional<User>> userCache = plugin.getBPApi().getUser(player.getUniqueId());
        User user = userCache.get();
        return String.valueOf(user.getTier());

But when i compile it throws the following error:

java.util.Optional<io.github.battlepass.objects.user.User> cannot be converted to io.github.battlepass.objects.user.User

What i'm doing wrong ?



from Recent Questions - Stack Overflow https://ift.tt/3akANdK
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations