Solved DELETE

Discussion in 'Spigot Plugin Development' started by TheBlackTeddy, Apr 29, 2017.

  1. DELETE
     
    #1 TheBlackTeddy, Apr 29, 2017
    Last edited: Jan 22, 2021
  2. sothatsit

    Patron

    If you want the skin of a skull to never change, save and set it's NBT data manually. The NBT data of a skull contains a url to the skin of the player that never changes. When the player changes their skin, the url sent by mojang is simply changed. Therefore, the old skin remains on the skulls with the old skin url.
     
  3. sothatsit

    Patron

    Ah, in that case just re-create the skull every time the player logs in using the player's name. You can set its skin via its SkullMeta.

    For example:
    Code (Text):
    ItemStack skull = new ItemStack(Material.SKULL_ITEM);

    SkullMeta meta = (SkullMeta) skull.getItemMeta();
    meta.setOwner("playerName");
    skull.setItemMeta(meta);

    // Use skull
     
  4. sothatsit

    Patron

    Yes it does work. The server already has to retrieve the player's new skin when they log in, and it caches it so the request does not have to be made more than once. There is literally no better way to do this.
     
  5. sothatsit

    Patron

    Yes it does. You do not know what you are talking about.
     
  6. PQE

    PQE

    Bro.
    They probably do something very similar to this. I don't think you understand that it will be the same UNTIL you see change your SKIN (at which point when you login the skull will be created from a different skin, hence it looks different). I don't really see a way to only update it when it changes their skin as changing skins is not server-side at all.

    Maybe they have a way to get the skin attached to a player's UUID and set it to that, but that would require storing unnecessary data.
     
    • Informative Informative x 1
  7. sothatsit

    Patron

    You do not know how this works. Just do what I said and it will work every time. This is exactly how Hypixel would do it, and do not tell me otherwise. When you set a skull by name, the skin is likely already cached on the server and no additional requests are made. Do not claim you know any different unless you give me a source class in the Spigot server where this takes place. As you might notice, I have created a plugin working exclusively with player heads, and as such have a very good knowledge of how they work. Do not claim you know any differently based on mere guesses.
     
    • Optimistic Optimistic x 1
  8. sothatsit

    Patron

    You are a fool. Show us your code.
     
    • Agree Agree x 3
  9. PQE

    PQE

    Why can you not just update it when the player joins?

    Just use the SkullMeta and set its owner.
     
  10. PQE

    PQE

    What message do you get when too many requests are made per unit time?
     
  11. sothatsit

    Patron

    Show. Your. Code.
     
  12. sothatsit

    Patron

    If you want me to help. Show your code. It's not difficult. Copy. Paste. How hard is that? I know you are wildly incompetent at making clear your points on the internet, but even you should be able to do this.
     
  13. sothatsit

    Patron

    Ok. You are that dumb. I'm trying to help you. I'm not sure why, but I am. Yet you are wholly uncooperative in helping me help you. I do not know why people are so hesitant to put their code online.
     
  14. sothatsit

    Patron

    The issue may be to do with the fact that the server authentication and skin cache for skulls do not share the same cache. I assumed they did as anything else seems counter-productive. If this few seconds is a huge issue to you, you will get the best possible results by getting the game profile of the player and using this to construct the skull. The NMS EntityPlayer contains a getProfile() method that you can use to get the GameProfile. You can then set the profile field in CraftMetaSkull (the implementation of SkullMeta) to this GameProfile using reflection. Then apply this skull meta to the item and it will have the skin of the player if it was returned by the authentication servers, otherwise there is no other way, it will have to query the mojang servers for them. This is your best hope.
     
  15. sothatsit

    Patron

    If you use the game profile from the entity player it is very likely to have the textures were returned when it made the authentication request for the player (Unless you are running an offline server this request is made for every login). As such, no additional requests should be made if you do this.
     
  16. sothatsit

    Patron

    What is the point?
     
  17. sothatsit

    Patron

    You really have no clue how this works.

    The skin is not retrieved every time you set the nbt data of the item. It is only retrieved when it is not available, such as when a player logs in or when it's not cached and you set a skull by its name. Therefore, by using the GameProfile of the EntityPlayer it should never have to retrieve the skin data more than when they log in (Which it is doing regardless of whether you use the skin data as it has to authenticate the player).

    Once the item is sent to the player, the client then has to download the skin unless it has it cached already. Hence, if you give the player a random head the client will always have to download its texture, the texture is not sent by the server, only a link to it. There is no way you can get around that.
     
    #17 sothatsit, May 1, 2017
    Last edited: May 1, 2017
  18. sothatsit

    Patron

    Just recreate it from the EntityPlayer's game profile every time. If their skin hasn't changed, the item won't be any different. If their skin has changed it will be. It's just data, the client doesn't know if you recreated it or not, and it does not care.
     
  19. sothatsit

    Patron

    Depends if the client has the skin cached. There is nothing you can do to get around that.
     
  20. Mojang had one data base and that data base stores skins of players, not the last time they changed it.

    Computers, while being very powerful machines, work by using a very simple logic system of yes and no questions.

    Now, how will this computer process this 'if' statement of whether a player changed their skin if all it has to work with is a database storing said skins?

    It needs to check this database in order to determine if the skin has changed. When is the most convenient time to do this task? When the player logs in.

    Now, to solve that too many requests error, try making a queue instead of trying to set it immediately when a player joins. That might solve it. Or a delayed task. So your players can enjoy their wonderful non-steve skull for a period of time before you decide to check. Or use a random number generator to decide whether to check. Maybe hypixel is good at hiding the truth?

    Now, is this a yes or a no?
     
    #20 xBallisticBlazex, Jun 18, 2017
    Last edited: Jun 18, 2017