crwdns129425:0crwdne129425:0

crwdns129427:0:javadoc:crwdne129427:0

crwdns129429:0:javadoc:crwdnd129429:0:javadoc:crwdnd129429:0:javadoc:crwdnd129429:0:javadoc:crwdne129429:0

crwdns129431:0crwdne129431:0

  • crwdns129433:0crwdne129433:0

crwdns129435:0crwdne129435:0

crwdns129437:0crwdne129437: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);
}

crwdns129439:0crwdne129439:0

Note

crwdns129441:0crwdne129441:0

Tip

crwdns129443:0crwdne129443:0