crwdns148651:0crwdne148651:0

crwdns148653:0:javadoc:crwdne148653:0

crwdns148655:0:javadoc:crwdnd148655:0:javadoc:crwdnd148655:0:javadoc:crwdnd148655:0:javadoc:crwdne148655:0

crwdns148657:0crwdne148657:0

  • crwdns148659:0crwdne148659:0

crwdns148661:0crwdne148661:0

crwdns148663:0crwdne148663:0

import java.util.Optional;
import java.util.UUID;

import org.spongepowered.api.Sponge;
import org.spongepowered.api.entity.living.player.User;
import org.spongepowered.api.service.user.UserStorageService;

public Optional<User> getUser(UUID uuid) {
    Optional<Player> onlinePlayer = Sponge.getServer().getPlayer(uuid);

    if (onlinePlayer.isPresent()) {
        return onlinePlayer;
    }

    Optional<UserStorageService> userStorage = Sponge.getServiceManager().provide(UserStorageService.class);

    return userStorage.get().get(uuid);
}

crwdns148665:0crwdne148665:0

Note

crwdns148667:0crwdne148667:0

Tip

crwdns148669:0crwdne148669:0