Advertisement
Guest User

s

a guest
Feb 14th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1.  
  2. @Override
  3. public void findProfilesByNames(String[] names, Agent agent, ProfileLookupCallback callback) {
  4. Set<String> unfoundNames = Sets.newHashSet();
  5. for (String name : names) {
  6. PreLookupProfileEvent event = new PreLookupProfileEvent(name);
  7. event.callEvent();
  8. if (event.getUUID() != null) {
  9. // Plugin provided UUI, we can skip network call.
  10. GameProfile gameprofile = new GameProfile(event.getUUID(), name);
  11. // We might even have properties!
  12. Set<ProfileProperty> profileProperties = event.getProfileProperties();
  13. if (!profileProperties.isEmpty()) {
  14. for (ProfileProperty property : profileProperties) {
  15. gameprofile.getProperties().put(property.getName(), CraftPlayerProfile.asAuthlib(property));
  16. }
  17. }
  18. callback.onProfileLookupSucceeded(gameprofile);
  19. } else {
  20. unfoundNames.add(name);
  21. }
  22. }
  23.  
  24. // Some things were not found.... Proceed to look up.
  25. if (!unfoundNames.isEmpty()) {
  26. String[] namesArr = unfoundNames.toArray(new String[unfoundNames.size()]);
  27. super.findProfilesByNames(namesArr, agent, new PreProfileLookupCallback(callback));
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement