Solved Checking player state

Discussion in 'Spigot Plugin Development' started by MadMaxCookie, May 25, 2016.

  1. hello how do I check if the player is alex or steve ?

    Edit : is there any possible way ?
     
    • Creative Creative x 1
  2. MiniDigger

    Supporter

    I can't see how this could be usefull but I guess you can get the gameprofile of the player and check his skindata
     
  3. You could run a little java code to receive data from a skindata site or something like that, then check it against 2 skins pre placed in your server or jar files.
    For example downloading it from "http://mcskinsearch.com/download/exoticcode" in another example or more setup example "http://mcskinsearch.com/download/%player%" which you would just switch out %player% with the player name and it should work.
     
  4. for me I'll use it to an void

    Code (Java):
    void setGender(Player player, String gender) {
      getConfig().set(player.getName() + ".gender", gender);
    }
     
  5. MiniDigger

    Supporter

    All the info you need to found on wiki.vg (http://wiki.vg/Mojang_API#UUID_-.3E_Profile_.2B_Skin.2FCape)
    you can get a gameprofile directly from the session server (eg. https://sessionserver.mojang.com/session/minecraft/profile/4566e69fc90748ee8d71d7ba5aa00d20)
    Code (Text):
    {"id":"4566e69fc90748ee8d71d7ba5aa00d20","name":"Thinkofdeath","properties":[{"name":"textures","value":"eyJ0aW1lc3RhbXAiOjE0NjQxNjEzNDE0OTIsInByb2ZpbGVJZCI6IjQ1NjZlNjlmYzkwNzQ4ZWU4ZDcxZDdiYTVhYTAwZDIwIiwicHJvZmlsZU5hbWUiOiJUaGlua29mZGVhdGgiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTNlODFiOWUxOWFiMWVmMTdhOTBjMGFhNGUxMDg1ZmMxM2NkNDdjZWQ1YTdhMWE0OTI4MDNiMzU2MWU0YTE1YiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjJiOWM1ZWE3NjNjODZmYzVjYWVhMzNkODJiMGZhNjVhN2MyMjhmZDMyMWJhNTQ3NjZlYTk1YTNkMGI5NzkzIn19fQ=="}]}
    the info you need is on the value attribute of the texture object. It is a base64 string. that decodes to:
    Code (Text):
    {"timestamp":1464161341492,"profileId":"4566e69fc90748ee8d71d7ba5aa00d20","profileName":"Thinkofdeath","textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/13e81b9e19ab1ef17a90c0aa4e1085fc13cd47ced5a7a1a492803b3561e4a15b"},"CAPE":{"url":"http://textures.minecraft.net/texture/22b9c5ea763c86fc5caea33d82b0fa65a7c228fd321ba54766ea95a3d0b9793"}}}
    if the player has a slim, alex style skin, there will be a "metadata": {"model": "slim"} tag under SKIN
     
    • Informative Informative x 1
  6. Thanks I'll start the coding.