Shopkeepers

Shopkeepers

2M Downloads

Items don't retain their internal data format after reloads (especially for item names and lore). As result trades no longer work

jumpdumpling opened this issue · 11 comments

commented

When adding/editing items in a shop, the items and trades look and work correctly. Some of my item descriptions/Lore can be in italics. By default, an item description and Lore will be in italics unless marked "italics:false". On server restart or plugin reload, the items with italics saved in shop no longer trade due to the "italic" settings being overwritten or changed in the shop.

The below item will produce a custom item in 1.14.3 that has a non-italic Name and then Italicized Lore. Works great until the mod is reloaded. Then italics go away. I believe the nbt data is not fully copying over to the save.yml file.

Use as item currency:

/give @p sunflower{
coin:lux_coin,
HideFlags:63,
display:{Name:"
{"text":"Lux Coin","color":"gold","italic":false}
",
Lore:["
{"text":"Good Lux!","color":"green"}
"]},
Enchantments:[
{id:"minecraft:fortune",lvl:2s}
]} 64

commented

This issue is possibly related to #617.
Using my plugin EpicRename version 3.6.2 on a server running CraftBukkit version git-Spigot-56f8471-56118c6 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT), I was able to correctly apply italics to ItemStack display names.

Command I used: /rename &oTest of italics
image

Item was saved correctly to the save.yml file:
image

Server was running Shopkeepers version 2.8.1.

commented

Still have to test this, but I assume this is a Spigot issue: https://hub.spigotmc.org/jira/browse/SPIGOT-5063

Edit: A workaround might be to use some plugin to create the item.

commented

Watching both the upstream issue and this one. Super annoying to have to reset the admin trades on my server every restart

commented

I've been following the https://hub.spigotmc.org/jira/browse/SPIGOT-5063, but it looks like it's either trapped in an unresolved duplicate or resolved for https://hub.spigotmc.org/jira/browse/SPIGOT-5213. Looking at the resolution, it looks like an update to the shopkeepers function using getDisplayName() to remove the weird character, but not sure if the color gets saved as it is not mentioned and isn't represented in the shopkeepers config. This pretty much kills the shopkeepers app for us at this time.

Good luck to you. Keep up the good work. (not being sarcastic) Cheers!

commented

This pretty much kills the shopkeepers app for us at this time.

Have you considered using a plugin for creating those items?

commented

I wouldn't think I need a plugin for simple give commands (example below). If your application can't handle retaining the meta data for the color in a non-legacy format then I'm not sure what a plugin would help with. I've even tried to just use the "\u00A76Coin" format, but when anyone tries to enchant an item/tool/weapon the name changes to "6Coin" which renders it unstackable in a different way.

I have reverted back to hand coding the villager as a /summon along with all the items using the correct format. It isn't as productive, but it works the way it is supposed to, so I'd have to rule out spigot/paperMC as the culprit.

Thanks again.

/minecraft:give @p sunflower{coin:x_coin,HideFlags:63,display:{Name:"[{"text":"Coin","color":"gold","italic":"false"}]"},Enchantments:[{id:"minecraft:fortune",lvl:2s}
]} 64

  • This just results in the "§6Coin" name and then can't retain the correct format.
commented

If your application can't handle retaining the meta data for the color in a non-legacy format then I'm not sure what a plugin would help with.
[.] so I'd have to rule out spigot/paperMC as the culprit

As pointed out above, this actually is an issue with Spigot's item serialization not retaining that data. Shopkeepers uses a certain piece of Spigot's API for saving and loading items to and from files. The implementation of that is inside of Spigot, Shopkeepers only invokes it.
Reimplementing and maintaining this would be out of scope to do as part of a plugin.

commented

Another workaround might be to use legacy color codes inside the command. For example like this:
give @p minecraft:emerald{display:{Name:"{\"text\":\"\\u00A7a\\u00A7oEmerald Name\"}",Lore:["{\"text\":\"\\u00A76\\u00A7oLore\"}"]}} 1

commented

This could possibly shed some light on the situation. I have been having this happen with Shopkeeper and Shop in regards to keys from GoldenCrates for Shop and several other items for Shopkeeper. This is the bug report that snowgears opened for his Shop plugin.
Shop#144

commented

I am not aware of any issues related to the data of the PersistentDataContainer. I just tested this and can confirm that the data is getting saved and loaded fine: http://prntscr.com/uhxcg5

commented

With the latest Spigot changes (https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/560b65c4f8a15619aaa4a1737c7040f21e725cce) this should be resolved.

I have tested this briefly and it seems that everything works fine. However, if you update your server make sure to create a backup of your save data, just in case something goes wrong.