Skip to content

Instantly share code, notes, and snippets.

@hivemc
Created October 26, 2013 21:02
Show Gist options
  • Save hivemc/cd9bd3d7f743e615b38b to your computer and use it in GitHub Desktop.
Save hivemc/cd9bd3d7f743e615b38b to your computer and use it in GitHub Desktop.
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