Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Minecraft UUID Api for ComputerCraft, a minecraft mod, written in lua
- --By minimite
- function get(username)
- local html = http.get("https://api.mojang.com/users/profiles/minecraft/"..username.."")
- local read = html.readAll()
- local read = read:gsub("{","")
- local read = read:gsub("}","")
- local read = read:gsub('"',"")
- local read = read:gsub(",","\n")
- local read = read:gsub("id:","")
- local read = read:gsub("name:","name: ")
- local read = read:gsub("\nname: [^\n]*","")
- local read = read:gsub("\nlegacy:true[^\n]*","")
- if read == "" then
- return nil
- end
- return read
- end
- function random(template)
- local random = math.random
- local template = template or "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx"
- return string.gsub(template, "[xy]", function (c)
- local v = (c == "x") and random(0, 0xf) or random (8, 0xb)
- return string.format("%x",v)
- end)
- end
- function names(uuid)
- local web = http.get("https://api.mojang.com/user/profiles/"..uuid.."/names")
- local all = web.readAll()
- if all == "" then
- return nil
- else
- return all
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement