Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getZombieSkin(p: player) :: object:
- set {_zombiegameprofile} to new WrappedGameProfile(new uuid, name of {_p})
- {_zombiegameprofile}.getProperties().put("textures", new WrappedSignedProperty("textures", "eyJ0aW1lc3RhbXAiOjE1NDQ0NTk4Mzc4MjMsInByb2ZpbGVJZCI6IjQzYTgzNzNkNjQyOTQ1MTBhOWFhYjMwZjViM2NlYmIzIiwicHJvZmlsZU5hbWUiOiJTa3VsbENsaWVudFNraW42Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZDY3NTUzYjMxOGJhMmVlMmI2MjZlOWI5ZGVkM2UxNWExZDBkOGQ5ZjM3MGZmMDNjOThiMzIzZTc4NTczYjlhIn19fQ==", "yUVWH96rIrYzOO4fCeB30pPSsdyaMJHwP0jKPfd+cfp5Bk5uOd5g547ISckhU0bZMWAkKqEeXUY3R1hsW3GJl+OKdTQwkKVhSdWf6AEV0LaTPav8TCd5jF2JVWDlGeXgHTp+TdBZPJIdWT1uuLuY42YdTfMGsywFE0rGljRo97hpMvBhgRcakw6d4friHUfzJy9shVeXW4gF8xZg79DP+WZ32F/IrsgoRU5O2nxM9ZgmjyaLTyO9WKQoMEpcLJl8vAet2NjJ1YH6klOxnqZpjYPebQuyfFb/ZfTfJv+AevccDCqr1T7OEM2u3MTwttcov5KbnhawrHZnVIBio2sTQGFUmzcsmIJht04YWGkQlrvSzQ4+6/Qyzixl4PE3pfbwg3truuJgItstLLbnNKFqa3H/RQam18vKdM8u7lqOomP4fWP4VEhBcIElnfwohy0PRJ+KOA5586WupKD3bxiAViUN4ywj212gyG6ie8KDDfrtC+e3VOWi/Vja+bJEmy2oHUndesySAZhNNMhrRIOYAARrhpcR0Cl8TmTVCYC4ooaKTdowi8cELLBxCnCJElozKUv2jhoWrpL4ZCSAepz85NdiQk2NjSNqgUOKzxf/pLD4iPs9R0+bVipyN8eGTpSzDdAQ4xO8n2nPQbcqfzqlIfY5hPF0S0+gApK68VXBGkA="))
- set {_gameprofile} to WrappedGameProfile.fromPlayer({_p})
- set {_property} to try {_gameprofile}.getProperties().get("textures").iterator().next()
- if {_property} is set:
- set {_value} to {_property}.getValue()
- set {_json} to new String(Base64.getDecoder().decode({_value}.getBytes()), "UTF-8")
- put json {_json} parsed as jsonobject in listvar {_json::*}
- set {_model} to {_json::textures::SKIN::metadata::model}
- set {_url} to {_json::textures::SKIN::url}
- {_url} is set
- set {_skin} to ImageIO.read(new URL({_url}))
- set {_zombieparts} to ImageIO.read(new File("./plugins/ZombiePlayers/zombie_parts.png"))
- loop {_skin}.getWidth() times:
- loop {_skin}.getHeight() times:
- set {_color} to new Color({_skin}.getRGB((loop-number-1)-1, (loop-number-2)-1), true)
- set {_r} to floor({_color}.getRed()/256*118)
- set {_g} to floor({_color}.getGreen()/256*166)
- set {_b} to floor({_color}.getBlue()/256*90)
- set {_a} to {_color}.getAlpha()
- {_skin}.setRGB((loop-number-1)-1, (loop-number-2)-1, new Color({_r}/255, {_g}/255, {_b}/255, {_a}/255).getRGB())
- set {_graphics} to {_skin}.getGraphics()
- {_graphics}.drawImage({_zombieparts}, 0, 0, null)
- {_graphics}.dispose()
- set {_outputstream} to new ByteArrayOutputStream()
- ImageIO.write({_skin}, "png", {_outputstream})
- {_outputstream}.flush()
- set {_buffer} to {_outputstream}.toByteArray()
- set {_connection} to Jsoup.connect(uncolored "https://api.mineskin.org/generate/upload?name=&&rmodel=%check [{_model} is ""slim""] ? ""slim"" : ""steve""%&visibility=1").userAgent("ZombiePlayers").method(Method.POST!).data("file", "zombie_%name of {_p} in lower case%.png", new ByteArrayInputStream({_buffer})).ignoreContentType(true).ignoreHttpErrors(true).timeout(5000)
- set {_body} to try {_connection}.execute().body()
- put json {_body} parsed as jsonobject in listvar {_bodyjson::*}
- {_bodyjson::data::texture::value} and {_bodyjson::data::texture::signature} is set
- {_zombiegameprofile}.getProperties().removeAll("textures")
- {_zombiegameprofile}.getProperties().put("textures", new WrappedSignedProperty("textures", {_bodyjson::data::texture::value}, {_bodyjson::data::texture::signature}))
- return {_zombiegameprofile}
Advertisement
Add Comment
Please, Sign In to add comment