#get GameProfile from UUID (including offline players) [RESOLVED]

11 messages · Page 1 of 1 (latest)

cerulean dawn
#

[1.21.5 0.16.14 JAVA_21]
I'm trying to get a GameProfile, by UUID. (Slightly different than yesterday, where I wanted a UUID from a name.)

----------------------------------------------------------------------------------------------------------------

Idea 1

This function always* return null from the isPresent() check.
* It does not return null only if the user has been otherwise discovered elsewhere.

public static GameProfile getGameProfileFromUUID(UUID uuid) {
        UserCache userCache = server.getUserCache();
        if(userCache == null) {
            return null;
        }

        Optional<GameProfile> potentialGameProfile = userCache.getByUuid(uuid);
        if( !potentialGameProfile.isPresent() ) {
            return null;
        }

        return potentialGameProfile.get();
    }

Idea 2

server.getGameProfileRepo().findProfileByName(name);

doesn't apply here since I'm (approximately) trying to do that in reverse.

Idea 3

ProfileResult temp = server.getSessionService().fetchProfile(uuid, true); //true or false
String name = (temp == null ? "null" : temp.profile().getName() );

Always returns "null" (I'm testing for a known account, "Notch": "069a79f4-44e9-4726-a5be-fca90e38aaf5").
Note: I am connected to the internet (well) on my development device.

This was the only idea that we ended up talking about before @ #mod-dev-2 message .
TL;DR: (auth) client is null, not sure if this is normal but the apiService initialized before worlds (where I tail-call this), so it should be normal?

----------------------------------------------------------------------------------------------------------------

I believe I'm looking in the right places but am failing to get anything to work.

#

For any more context, I originally asked this at #mod-dev-2 message.

cerulean dawn
#

For anyone scrolling, I'm still facing this problem.

slate aspen
#

You're connected to Internet but are you playing in "offline" mode/runclient?

#

Maybe that effects

cerulean dawn
#

Hey, actually- the server being run in the IDE probably is in some form of offline? Maybe.

It's worth testing at least-

cerulean dawn
slate aspen
#

Check dm

grim flower
cerulean dawn
ocean glenBOT
#

@cerulean dawn: Unknown tag, use !tag to see all available tags