Advertisement
pez252

onPlayerJoin.txt

Feb 6th, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. // When players join, lookup their old names
  2.  
  3. if( (!MODULEJSON) || (!MODULEHTTP) )
  4. log("&cThis Script needs the JSON & HTTP Module")
  5. stop
  6. endif
  7.  
  8. &uuidjson = httpget("https://api.mojang.com/users/profiles/minecraft/%JOINEDPLAYER%","",#status1)
  9.  
  10. if(#status1 = 200)
  11. &uuid = jsonget(%&uuidjson%,"id")
  12. replace(&uuid,\",)
  13. //log("UUID: %&uuid%")
  14. &namesjson = httpget("https://api.mojang.com/user/profiles/%&uuid%/names","",#status2)
  15. if(#status2 = 200)
  16. &names[] = GetJsonAsArray(%&namesjson%)
  17. #names = arraysize(&names)
  18. #names = #names-2
  19. &oldnames = "Old names:"
  20. if(#names>-1)
  21. for(#i,0,%#names%)
  22. &name = jsonget(%&names[%#i%]%, "name")
  23. &oldnames = "%&oldnames% %&name%"
  24. next
  25. log("%&oldnames%")
  26. endif
  27. endif
  28. if(#status2 != 200)
  29. log("&cStatus getting names: %#status2%")
  30. endif
  31. endif
  32.  
  33. if(#status1 != 200)
  34. log("&cStatus getting uuid: %#status1%")
  35. endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement