crwdns39489:0crwdne39489:0

crwdns39490:0:javadoc:crwdne39490:0

crwdns39491:0:javadoc:crwdnd39491:0:javadoc:crwdnd39491:0:javadoc:crwdnd39491:0:javadoc:crwdne39491:0

crwdns39492:0crwdne39492:0

  • crwdns39493:0crwdne39493:0

crwdns39494:0crwdne39494:0

crwdns39495:0crwdne39495: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);
}

crwdns39496:0crwdne39496:0

Note

crwdns39497:0crwdne39497:0

Tip

crwdns39498:0crwdne39498:0