Fix gadget custom head texture not displaying on equip
Fix Gadget custom head texture not displaying on equip
What is the purpose of this pull request?
1. What does it do, and what issues does it solve?
This pull request fixes an issue where a gadget's custom head texture (specified via Custom-Head in the configuration) displays correctly in the cosmetic GUI but reverts to the default player head icon when equipped in the player's inventory. The change ensures that the custom texture is preserved during the equip process by leveraging the existing getItemStack() method from CosmeticType.
The issue occurred because the updateItemStack() method in the Gadget class previously created a new ItemStack using getType().getMaterial(), which ignored the Custom-Head texture. Now, it uses getType().getItemStack() to retain the custom texture, applying only the necessary name and lore updates.
Additionally, using custom head textures for gadgets prevents various exploits on survival servers. Players could previously obtain gadget items (e.g., a beacon from DiscoBall) through unintended means, such as dropping or glitching them out of the cosmetic system. This could disrupt server balance by granting access to powerful items. By consistently applying custom head textures, gadgets are visually and functionally distinct, reducing the risk of such exploits and maintaining gameplay integrity.
Changes
- [x] Update
Gadget.updateItemStack()to usegetType().getItemStack()for preserving custom head textures. - [x] Apply name and lore updates with
ItemFactory.rename. - [x] Retain cosmetic marker with
ItemFactory.applyCosmeticMarker.
How to Test
- Ensure a gadget with a custom head texture is configured, e.g.:
Gadgets: BatBlaster: Custom-Head: '7f578c9c0fd1a63379d0d166d0fa94c0dd9dba970e5adf1d78dd8985272ab168' - Open the cosmetics menu and verify that
BatBlasterdisplays the custom texture (e.g., a bat head). - Equip the gadget and check that the item in the player's inventory retains the same custom texture instead of reverting to a default player head.
- (Optional) Test with a gadget like
DiscoBall(originally a beacon) to ensure it displays as a custom head in the inventory, not a usable beacon item.
Thanks, appreciate the fix!
Additionally, using custom head textures for gadgets prevents various exploits on survival servers. Players could previously obtain gadget items (e.g., a beacon from
DiscoBall) through unintended means, such as dropping or glitching them out of the cosmetic system. This could disrupt server balance by granting access to powerful items. By consistently applying custom head textures, gadgets are visually and functionally distinct, reducing the risk of such exploits and maintaining gameplay integrity.
I'm a little confused by this, if you're aware of a way that cosmetic items can be obtained in survival please let me know, the plugin avoids that wherever possible.
Thanks, appreciate the fix!
Additionally, using custom head textures for gadgets prevents various exploits on survival servers. Players could previously obtain gadget items (e.g., a beacon from ) through unintended means, such as dropping or glitching them out of the cosmetic system. This could disrupt server balance by granting access to powerful items. By consistently applying custom head textures, gadgets are visually and functionally distinct, reducing the risk of such exploits and maintaining gameplay integrity.
DiscoBallI'm a little confused by this, if you're aware of a way that cosmetic items can be obtained in survival please let me know, the plugin avoids that wherever possible.
I totally get your concern about exploits and the plugin's efforts to prevent items from being obtained in survival—I really appreciate how much work has gone into making that robust.
To clarify what I meant: while UltraCosmetics does an awesome job at locking down gadget items within its own mechanics, there are tons of external plugins out there—like auction house plugins, inventory storage systems (e.g., backpacks or vaults), or trading plugins—that mess with inventories in ways that can sometimes bypass those protections. For example, if a gadget item gets into an inventory slot and another plugin lets players drop, trade, or auction it, they might end up with something like a beacon from DiscoBall in survival. It’s not necessarily a flaw in UltraCosmetics itself, but more about how these third-party plugins interact with inventories in unpredictable ways. Fixing every possible interaction would be a Herculean task given how many such plugins exist and how they evolve.
That’s where the custom head textures come in as a safeguard. By making gadgets visually and functionally distinct (e.g., turning DiscoBall into a custom head instead of a beacon), it reduces the chance that players can misuse them as vanilla items, even if they somehow slip through via another plugin. It’s not about a specific exploit I’ve seen, but more of a proactive step to harden the system against the chaos of survival server ecosystems.