How to change skin and cloak

Discussion in 'Plugin Development' started by LIMPIX31, Apr 17, 2021.

  1. Offline

    LIMPIX31

    How to change skin and cloak using bukkit api or NMS(1.16)
     
    Last edited: Apr 17, 2021
  2. Offline

    Wick

    You need to send a request to mojang's servers to get a skin texture and signature, then edit the player's gameprofile by inserting these values (clearing the old ones). You then need to hide and unhide the player for all other players for it show the updated skin.

    You''ll have to use NMS or reflection to edit a player's gameprofile, however, ProtocolLib is a better option as you can use the WrapperGameProfile class and edit that. To get the skin data you need to send a request to
    Code:
    https://sessionserver.mojang.com/session/minecraft/profile/<UUID>?unsigned=false
    If you google around you can find some implementations of this.
     
  3. Offline

    LIMPIX31

    Ok, can I set the player's skin (cloak) by getting my own image from the URL.

    Most likely, this can also be done via ProtocolLib?
     
  4. Offline

    EvilWitchdoctor

    TBH, this is maybe one of the very, very few cases where I would choose NMS over an external library like ProtocolLib.
    Code:
    import com.mojang.authlib.GameProfile;
    ^ the GameProfile api hasn't changed in basically forever, and unlike most NMS code the package name doesn't include the server version.
    Of course, if you're doing other stuff that requires NMS-y things (in which case you need ProtocolLib), then I'd recommend using ProtocolLib's wrapper for GameProfile.
     
  5. Offline

    Wick

    You can only get skin data from a Minecraft account because you need a signed value which only mojang can create. To set a player's skin with an image URL you'd have to use something like MineSkin, but you'd have to do our own research on that.

    Yeah either works.
     
  6. Offline

    LIMPIX31

    How do I use mineskin in my plugin?
     
  7. Offline

    Wick

  8. Offline

    LIMPIX31

  9. Offline

    Wick

    The cape is tied with the skin texture value. If you change someone's skin they will get whatever cape that person has (assuming they have one)
     
  10. Offline

    LIMPIX31

    I need to change the cape to my image via the URL
     
  11. Offline

    Wick

    That's not possible as far as I know.
     
  12. Offline

    LIMPIX31

    I think this is possible using modifications, Fabric for example
     
  13. Offline

    timtower Administrator Administrator Moderator

    Which we don't support here as that requires a modded client.
     
  14. Offline

    LIMPIX31

    I know
     

Share This Page