Please make me an example code to set player skin

Sponge 8.0

How can I set player skin by file image .png

please help me. There is no any sponge (8.0) plugin to set player skin.

A few issues here.

The first (and biggest issue) is that you cant use a image file directly as a skin. Instead the image file needs to be uploaded as someone’s skin which will give out a licence key (id if you will) and that licence key is used for the skin.

Secondly, swapping skins isnt officially supported in Minecraft, so its not officially supported in sponge. There is a little trickery that goes into swapping the skin. Essentially you need to remove the player whos skin your swapping from everyone and then readd them, that will trigger the clients to reget the skin for that player. To add and remove a player it should be disconnect and reconnect but i know some skin changers do it by teleporting the player to another world and then back (not sure if that works on all versions). Another way would be to remove the player from the tab list (this makes it so the player is effectively disconnected to the tab list owning player) and then readd them

As for how to actually change the skin, this is how skin restorer does it (which does work on API 8, just need to fix the gradle script latest dev build works without modification)

1 Like