Issues with item names NBT Tags text formatting
juancruzdal opened this issue · 1 comments
Preliminaries:
- Shopkeepers version:
2.16.5
- Spigot version:
1.19.4-527
Some items are not able to be traded because of the nbt tags, some items come with this useless data:
"underlined":false,"strikethrough":false,"obfuscated":false,
but when i give items with some plugin that useless data is not there and that makes the item not able to be traded
I suggest an option to ignore that useless data checking
This is not going to happen. Your best bet is to figure out where on your server you are generating these different variations of this item, and then resolve this issue by ensuring that you only ever generate a single variant.
Or use another shop plugin that does not use the vanilla trading interface.
-- More detailed explanation:
The shopkeeper trading tries to follow the vanilla trading rules as closely as possible, because any deviations result in "glitches" because some parts of the trading UI are actually handled on the client-side. For example, the client runs the same logic as the server to update which trading recipe is matched by the input items and which item to show in the result slot, basically overriding what server-side plugins might send what the result item should be.
Examples:
- If the Shopkeepers plugin makes the trading more lenient and accepts items that are not matching the trading recipe according to the vanilla item comparison rules, and thefore decides to manually set the result slot to the trade's result item on the server-side, the client will overwrite this and immediately clear the slot again. So the user always sees an empty trade result slot. I.e. on the client side, there is no item for the user to pick up from the trade. This is not an option.
- If the Shopkeepers plugin makes the trading more strict (e.g. like the
use-strict-item-comparison
setting), the client will still show the vanilla trade result item. This somewhat works, but is not ideal either due to this inconsistency and "glitch": When the user attempts to pick it up, the server cancels the trade according to the more strict rules, and the item is moved from the player's cursor back into the result slot.
The only option I see to implement more lenient trading rules would be to dynamcially modify the input items and/or the trading recipe items that are sent to the client, so that they match on the client side, even though they don't actually match on the server side. But this would require dynamically modifying the item packets that are sent from the server to the client, to make sure that the client consistently sees these 'fake' items.
But I really want to avoid having to add this additional complexity. Especially since prior experience with plugins attempting to achieve similar things by modifying the data that is sent to the client has shown that this is tricky to get right, and more often results in hard to debug bugs and glitches caused by inconsistencies between the server state and the client state.
Another option would be to automatically scan the input items and normalize them to a specific format. However:
- Minor: The Bukkit API itself doesn't offer an API to alter the raw NBT data of item text data, so one would have to fallback to some inofficial/unsupported mean to edit this data.
- Prior experiments with scanning item data in inventories and normalizing them has shown that this has quite a performance impact. Maybe this could be limited to the trade input items, and the trading recipes items (once, when they are loaded).
- However, if you don't normalize all items on your server consistently, players end up with other kinds of issues, such as items suddenly no longer stacking as expected.
So normalizing all items is not an option because it is actually hard to achieve and has a large constant performance impact, and only normalizing some items in specific cases causes these other kinds of item stacking issues.