-
-
Save hivemc/cd9bd3d7f743e615b38b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.mojang.api.profiles.HttpProfileRepository; | |
import com.mojang.api.profiles.Profile; | |
import com.mojang.api.profiles.ProfileCriteria; | |
public class BasicConverter { | |
private static final HttpProfileRepository profileRepository = new HttpProfileRepository(); | |
private static final String AGENT = "minecraft"; | |
public static String getUUID(String username) { | |
Profile[] profiles = profileRepository.findProfilesByCriteria(new ProfileCriteria(username, AGENT)); | |
if (profiles.length == 1) { | |
return profiles[0].getId(); | |
} else { | |
return null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment