Disabling capes on all players

Discussion in 'Spigot Plugin Development' started by Forty, Dec 15, 2017.

  1. Hey,
    I'm wondering about the implementability of hiding capes on all players.
    Not too long ago, the Settings menu received a feature where you can disable certain layers of your skin, and even the cape if you so wish (Skin Customization). Perhaps it would be possible to replicate disabling the cape layer?
    I am trying to create a feature where there will be no player capes present on the server. Their player skin, however, should remain the same.

    Thanks for any replies.
     
  2. You should look at the Player List Item packet, in the add player action it sends a property array, you will probably need to listen for the packet send and edit or cancel and recreate it.
     
  3. The encoded skin data that is sent in the Player List Item packet is Base64 encoded. When decoded, it is along the lines of:
    Code (json (Unknown Language)):

    Properties: {
        textures: {
            SKIN: {
                 // data
            }
            CAPE: {
                // data
            }
        }
    }
     
    It can't be separated because that will ruin the signature, unfortunately. :(

    EDIT:

    However, if the player ever does join with the cape disabled, you can cache the skin data and it will be valid forever, even if they change their skin or enable the cape again. But that wouldn't necessarily fit with your request that it be their current skin.


    EDIT 2:

    What you could do, similar to how WynnCraft changes skins, is have accounts that are just for getting signed skin data. Get the player with the cape, read their skin data and remove the cape, upload it to the skin account, then after it is signed you can download it and apply it to the player with the cape. Since it is a valid signed skin, then it will display correctly to clients and the cape will be gone.


    EDIT 3:

    Here's some information about the skin response format from wiki.vg.
     
    #3 Tedstar, Dec 15, 2017
    Last edited: Dec 15, 2017
    • Like Like x 1
    • Agree Agree x 1
  4. Never tried, but wouldn’t setting the cape data to “null” fix anything?
     
  5. That would make the skin have no cape, but since the entire "textures" object is encoded and that is what is signed, changing the cape value would invalidate the signature, and the client would not display it.

    The same reason is why you can't make a plugin to set your own cape data to a real cape and display it. The only way to falsely display a cape would be to use an account that already has that cape as the skin-changing account. (But that is not a good idea cause Mojang is very strict about capes in the eula.)
     
  6. Ohhh right aha my bad thank you, I know Wynn have difference Cape accounts for sure
     
    • Like Like x 1
  7. Instead of overwriting the cape each time I recommend overwriting the settings packet.
    http://wiki.vg/Protocol#Client_Settings

    Modify the bitmask -> setting for cape will always be disabled. Others can’t see it.
     
    • Winner Winner x 1
    • Informative Informative x 1
  8. Wow that's much simpler and now I learned a new thing! :D