Skip to content

Instantly share code, notes, and snippets.

@Carlgo11
Forked from hivemc/BasicConverter.java
Created October 26, 2013 21:10
Show Gist options
  • Save Carlgo11/9fa2f89209dbeac1d519 to your computer and use it in GitHub Desktop.
Save Carlgo11/9fa2f89209dbeac1d519 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