[CRITICAL] Can sell to shopkeepers for lesser amount
blablubbabcDEV opened this issue ยท 7 comments
Migrated from: https://dev.bukkit.org/projects/shopkeepers/issues/325
Originally posted by czaarek99 (Jun 23, 2015):
What steps will reproduce the problem?
- Create a shopkeeper
- Put in this example trade http://puu.sh/izo1c.png
- Put in the items in reverse, the emerald will appear http://puu.sh/izo3G.png
- Take out the emerald, now instead of removing 65 carrots the shopkeeper will remove 64 carrots from 1 carrot and remove 1 carrot from 64 carrots. Like this: http://puu.sh/izo5Z.pngWhat is the expected output? What do you see instead?
Expected output is for everything to be removed instead the carrots get removed on a per slot basis and this can be abused severly. Since now I get to keep 63/65 of my carrots, essentially selling 2 carrots for emerald instead of selling them at the set price of 65 carrots for one emerald.What version of the product are you using?
1.60Do you have an error log of what happened?
The plugin does not error when this bug happens.Please provide any additional information below.
Im kinda sad since some players have figured this out and ruined my economy :(
Originally commented by czaarek99 (Jun 23, 2015):
This is actually a minecraft bug, I was able to recreate it in a singleplayer 1.8.7 world. I am sending a minecraft bug report and trying to fix this myself by editing spigot but I am not the best coder and I assume you guys could fix this?
Originally commented by blablubbabc (Jun 23, 2015):
[at]czaarek99:
Yep, seems like a minecraft bug to me as well.
We could ask the spigot team, maybe they are interested in fixing this in the meantime themselves.
I can look into this later and see if I either add some check which checks for this situation and then blocks the trade, or modify the strict-item comparison setting to not only strictly compare items but also always make sure each slot has strictly the required item amounts as well.
Originally commented by czaarek99 (Jun 23, 2015):
[at]blablubbabc:
This commit should probably solve it, not going to try it myself since I dont feel like cloning and compiling. Anyway, this is the only case when the bug works. Only if the items are the same and they are not both x64. Will post here if I find anything similiar.
Originally commented by blablubbabc (Jun 24, 2015):
Should be fixed with v1.61, thanks for reporting.
Edited Jun 24, 2015
Originally commented by czaarek99 (Jun 23, 2015):
[at]blablubbabc:
Fixed it myself for now. Here you go, maybe it will help.
https://gist.github.com/anonymous/cb2745c035d3d54d27b8
Edited Jun 23, 2015
Originally commented by blablubbabc (Jun 23, 2015):
[at]czaarek99:
This bug is only occuring if the item in both slots are the same, right?
Edit:
I am going to upload an update later which hopefully prevents this special case. Check out this commit and let me know if you know of any other setups which might cause this issue: nisovin@d7403ef
Edited Jun 23, 2015