-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep player head skin #18
Comments
unfortunately this behavior is controlled by your server - PlayerHeads does not update the head texture for players, your server does - and there isn't usually much configuration for that. Somewhat ironically, a lot of people have the reverse problem also - the server failing to update head skins. This will happen as long as the head's name or UUID match the user - and if you change it, it would no longer be their head... |
huh, so there is no way to make it work like the plugin head database, which has tons of heads which I think they never change? |
If the head is linked to a name/uuid of a player they will change (PH player drops) - it shouldn't matter the plugin. but PH mob heads / custom heads (vanilla or custom UUID/texture) won't change since there is no mojang profile to download. It's important to distinguish between a player's head and a custom head since they have different behaviors. I imagine the head database plugin handles both player-linked (updating) and custom heads. It's possible to make a 'custom' head with the old texture for a player, but with different UUID. However the plugin would need to generate and store a log of UUIDs for each old head/texture to be recognized the same and prevent updating - and they wouldn't stack or work in villager trades with more updated heads. |
hey, author of DecoHeads here -- i see you modify the output of BlockBreakEvents so that the dropped item has the correct name, lore, etc. when you break a placed PlayerHead. i also see you have an option would it be possible to make this option or some other option that simply prevents custom handling of BlockBreakEvents? or, perhaps even better, fetches the GameProfile from the block's state (I think you can do this) and then uses this information directly to set the GameProfile on the item? custom GameProfile data is how plugins like DecoHeads use custom textures without associating usernames would be nice to have a way to make your plugin play nice with other plugins which deal in custom heads :) EDIT: I'm not sure if it's as easily accessible in all versions, but I just checked a 1.8 JAR i had lying around, and it looks like this is trivial to do: public class CraftSkull extends CraftBlockState implements Skull {
private static final int MAX_OWNER_LENGTH = 16;
private final TileEntitySkull skull;
private GameProfile profile; and then there are pretty easy version-independent ways to set GameProfiles on skull items with reflection so you could preserve the GameProfile itself when creating the custom item to drop |
'convertvanillaheads' is used by admins that want PH to use all-custom or mixed-vanilla-custom heads (depending on dropvanillaheads) - (the default behavior is to only use custom heads to extend the existing head list) If you look in the method you linked, you will see it calls blockDrop which can modify the dropped item.
For nonvanilla mobheads, PH pretty much relies on a reserved-UUID (unused UUID) system for heads and no username. getOwner() generally fails for these types of heads, and this seems to be the same way things like the MCHeads db do custom heads. For re-setting the profile should be possible, I think. I believe both methods were already tested and coded into the ProfileUtils class. (PlayerHeads-craftbukkit-support)
that said, resetting the game profiile like you mention should be possible to prevent re-retrieving the skin for players (like in OPs concern - detecting custom heads is a different issue), I didn't think of it saving the block profile for later, but that's totally doable.
indeed and I use an implementation already because of textures support and issues with bukkiti api owner resolution. I should be able to modify it to do what you suggest, I think. So again, two takeaways I see:
EDIT: Although I will comment though that even when heads are not from the plugin, and their profile is maintained, their texture can still expire in line with the timestamp field. Although it may(?) be possible to update the timestamp to delay skin updates. |
Here is a development build that adds two configuration options:
I don't notice any immediate big change (or benefit) and this has not been tested heavily, but I can tell you that if "fixdroppedheads" and "fixbrokenheads" are both disabled, head-blocks that are broken will just become undecorated "Player Head" (but retain the texture/uuid). Dev build/CI: https://ci.meme.tips/job/PlayerHeads-5.x/1088/ The easiest way to implement the second feature was to set the profile on the meta right before setting the meta on the item [1][2] - hopefully wiping out the previous owner information with the restored version, but I still need the verify the behavior. |
Regarding issues with PH and other plugins, I don't know if you were referring to your own plugin or not, but when I test DecoHeads, you appear to set the SkullOwner.Name tag with your item-name. See below:
SkullOwner.Name is typically blank for custom heads, and reserved for putting usernames into. I don't see a way to avoid the issue outside of:
Aside: |
I see, I originally copied the custom head code from mrCookieSlime, and was not aware that you could simply pass so assuming I make that change, along with the new options present here, this should eliminate any compatibility issues? at least with decoheads, I'm unsure of how heads database handles custom heads or whether or not this will work for them directly. |
I won't guarantee it fixes all issues, but it should fix the issue where PH changes DecoHeads into "Microwave's Head" etc. I didn't notice any other immediate issues though. So I think that's a good start. Regarding HeadDB, I'll admit I haven't looked at their code yet (it's a paid plugin), but their website (minecraft-heads.com, similar to freshcoal) presents the generated commands without a name field. (and the resulting head does not have one set) |
@rayzr522 You may have already found out, but I wanted to mention that, much to my displeasure, the newest Authlib versions now disallow passing null as the username when creating a GameProfile (the data structure that carries the head UUID/name/texture) - so I'm probably going to go the way of DropHeads and HeadDB plugins where the username will be "PlayerHeads:uuid". As the attached commit shows, ":" is what I'm filtering-out at the moment when detecting an actual player-named head. I'm not sure why they decided on this change since nameless heads seem like they would make perfect sense for a head that is not attached to an account. I'm hoping the invalid head name + uuid will reduce the amount of Mojang API calls servers make to resolve heads, but I worry about that. |
Describe the solution you'd like
When players change their skin, the head also changes the skin, It would be better if it saved the head skin forever, maybe add a setting for those who dont want this behavior?
The text was updated successfully, but these errors were encountered: