[Unnicker] How to get the Textures / Property of the GameProfile of a Player
Solved
ScriptAPI
-
A certain Server has a Nickname System which changes the Name and the Skin of the Player but the Skin of the nicked Player isn't the Skin of the Nickname.
What i try to do is, when a Player nicks himself, the Script checks if the Skins aren't the same.
I need to get the Property of the (Skin)-Texture of the Player in the Tablist, so i can check if its the same Texture as the Skin of the UUID stored at:
https://sessionserver.mojang.com/session/minecraft/profile/<UUID>///api_version=2 (script = registerScript({ name: "Unnicker", version: "1.0.0", authors: ["Marlon"] })).import("Core.lib"); var S38PacketPlayerListItem = Java.type("net.minecraft.network.play.server.S38PacketPlayerListItem"); var Action = Java.type("net.minecraft.network.play.server.S38PacketPlayerListItem.Action"); var AddPlayerData = Java.type("net.minecraft.network.play.server.S38PacketPlayerListItem.AddPlayerData"); var Property = Java.type("com.mojang.authlib.properties.Property") script.registerModule({ name: "Unnicker", category: "Misc", description: "Warns when someone is nicked" }, function (module) { module.on("packet", function(eventData) { var packet = eventData.getPacket(); if(packet instanceof S38PacketPlayerListItem) { if(packet.getAction() == Action.ADD_PLAYER) { var entries = packet.getEntries(); var firstEntry = entries.get(0); var gameProfile = firstEntry.getProfile(); var properties = gameProfile.getProperties(); var textures = properties.get("textures"); Chat.print(textures); } } }); });
Output of the Code is:
But if i run the Method "getName()" for example it wont show anything in the chat.
Hope someone understands my problem and can solve it. -
@FaaatPotato Thank you it works!
-