Shopkeepers

Shopkeepers

2M Downloads

Shopkeeper dosent work in paper 191

Draghonir opened this issue · 4 comments

commented

Hello, my shopkeeper doesn't work after updating my paper build to 191 Capture d’écran 2023-09-17 021935

commented

Should be fixed in Shopkeepers version 1.17.2.

A build of this fix is available here: https://github.com/Shopkeepers/Shopkeepers/actions/runs/6215030249
Please let me know if you can confirm this to fix the issue on your side as well.

Background: Although extending the ItemStack class in plugins might not be officially supported, I don't see any other way of implementing an unmodifiable ItemStack view type that errors on attempted unexpected modifications and can be used as a substitute for the ItemStack type in any method (including API methods) that accept an ItemStack. Ideally, the API itself could provide such a type at some point, but I consider this usecase rather niche currently to further push this case upstream.

commented

I didn't do anything special; everything was working fine. I just updated the Paper JAR, and now none of the shopkeepers are working.

I tried to download the latest build on GitHub version 166 to see if the bug is patched, but it didn't work.

1
commented

Confirmed fixed in Shopkeepers 1.17.3-SNAPSHOT-b168 with Paper 1.20.1-193. Presumed fixed in Shopkeepers 1.17.2-b169 as well. Thanks.

commented

My current bet is that this issue is caused by the new isEmpty method added by Paper 185: PaperMC/Paper@deb92c2

The implementation references the ItemStack's type and amount fields directly. This breaks compatibility with the current way of how the Shopkeepers plugin implements its UnmodifiableItemStack (an extended ItemStack that overrides the getType and getAmount methods).
During the item migration, a call to CraftItemStack.asNMSCopy is made, which now thinks that the UnmodifiableItemStack is empty even though it is not. So the non-empty item is migrated to an empty item, which is picked up by the migration logic as "the migration failed".

Still checking for a solution.