Profile data caching API?

Discussion in 'Spigot Plugin Development' started by bsy6766, Jun 10, 2015.

  1. Since Mojang limits the rate of player profile to once per minute for same IP(not sure about IP though), some plugins and servers have issue with downloading same player's profile using Mojang's API. (like heads)

    So I thought it will be nice to us(plugin developers who use player skin) to have some kind of common API (like Vault for economy) that saves player profile data and I was wonder if there's any good one that exists already so that I can use it on my plugin.
     
  2. Maybe I can make one if it doesn't exists...
     
  3. There are several websites that have playerlookup apis with caching. Google it or search on the forums to find some.
     
  4. Why can't you use ((CraftPlayer)Bukkit.getPlayer("thePlayer")).getProfile()? If you're getting offline players, just make a hashmap.
     
  5. Oh didn't know there was something like this. So using CraftPlayer doens't uses Mojang's API?
     
  6. CraftPlayer is just a cast; Player to CraftPlayer. Once you've got the craftplayer, you can get the players profile without the need to contact the mojang server. Player must be online though
     
  7. JamesJ

    Supporter

    Unless your calling >600 in 10 minutes, you wont get locked out.
     
  8. JamesJ

    Supporter

  9. JamesJ

    Supporter

  10. Seems like this method doesn't cause the issue I have. But I need offline player's data as well :(
     
  11. You'll just have to make a hashmap/arraylist with your gameprofile's for a means of caching.
     
  12. A players profile (when cached) only needs to be updated when the name no longer matches with the online player it was associated with. Not to mention it's only a 1 minute delay, I doubt you need to fetch the same profile that quickly.

    If you're worried about cached items not being accurate you have to live with the 1 minute delay in your case. When the name no longer matches or the skin the player is using doesn't match the cached skin you have, you can flag the profile for update that an automatic process takes care of after its minute is over.