There are still some bugs in the shop in my Bedwars system.
Of course they have to go!
Mistake no. 1: Example end stone (1 block for 8 bronze): If I have more than 1 stack and 8 bronze in my inventory and click on the end stone, 8 will be subtracted from the first stack (e.g. 9 stack). So that I still have 1 stack & 1 bronze. If I click on the end stone again, I have a stack bronze and a -6 stack bronze. When I click on it again, I have a stack bronze and a -14 stack bronze. Keep it up. Until the stack reaches -120, it goes up to 120 and everything starts again. The other stack is not touched. As soon as you have 2 stacks, you can duplicate resources.
Mistake No. 2: Example sandstone (2 blocks for 1 bronze): If you e.g. If you have 4 stacks of bronze in your inventory and click shift while clicking on the sandstone, you should actually get a stack removed and then automatically get 2 stacks of sandstone. You also get 2 sandstone, but all bronze is removed at once.
Does anyone have a solution to the two errors?
Here is the code:
Item purchase listener (for end stone):
getAmountBronze (built into the item purchase listener to get the number of bronze items in the inventory):
It is probably a bit complicated, but thanks anyway if someone has an idea.
Use
player.getInventory () removeItem (itemStack).
itemStack is the item with the amount that you want to remove
Thank you! Unfortunately, I have never heard of the method. Well, that solves all my problems!
It's a pleasure