[SPIGOT-1896] setAmount off by one. Created: 12/Mar/16 Updated: 17/Dec/16 |
|
Status: | Open |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | coll1234567 | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 0 |
Labels: | 1.9, Inventory |
Issue Links: |
|
Description |
When using item.setAmount() it sets the amount one higher than what you specify, this also seems to create issues with other methods such as inventory.removeItem() which will not remove items when the stack size is 2 or less. |
Comments |
Comment by md_5 [ 10/Jul/16 ] |
if (!event.getItem().equals(craftItem)) {
itemstack.count++;
This code is everywhere and seems intended because then the dispensed item will have the count which you set it to. Subtracing one off it might be unexpected. |
Comment by coll1234567 [ 12/Mar/16 ] |
Yes, It appears to only occur within this event. Tested with a player interact event and it works fine. |
Comment by md_5 [ 12/Mar/16 ] |
But it's only off by one in this event, if you do it elsewhere it's fine? |
Comment by coll1234567 [ 12/Mar/16 ] |
Occurs with both droppers and dispensers. |
Comment by md_5 [ 12/Mar/16 ] |
Please include a test case |
Comment by coll1234567 [ 12/Mar/16 ] |
Tested using a dispenser inventory, unsure if it occurs with other inventories. |