[SPIGOT-2869] Summary Created: 30/Nov/16  Updated: 02/Dec/22  Resolved: 02/Dec/22

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: user-b06a8 (Inactive) Assignee: Unassigned
Resolution: Incomplete Votes: 1
Labels: None

Issue Links:
Duplicate
is duplicated by SPIGOT-3210 Giving a player an itemstack in Playe... Resolved
Relates
relates to SPIGOT-1896 setAmount off by one. Open
relates to SPIGOT-4162 BlockDispenseEvent triggers after dis... Resolved
Version: Version
Guidelines Read: Yes

 Description   

Description



 Comments   
Comment by Madeline Miller [ 05/Jul/20 ]

I've had a few potential ideas to fix this in a non-breaking way over the years. None of them are proper fixes and instead workarounds - and hence won't fix cancelling the event still removing the item. IMO that is still something that should be fixed, as not doing that goes against the concept of "cancelled".

As for my potential non-ideal but non-breaking solutions,

  • Adding a method to get a snapshot of the original BlockState with the item still in the inventory
  • Adding a method that provides the slot that the item was removed from. This allows the plugin to just add the removed item to that stack to get the original inventory state. Pretty hacky but works

I do feel that moving when this event is called is the best solution, but it is potentially breaking, especially for plugins that have attempted to work around this issue.

Comment by William Gaylord [ 26/Dec/16 ]

I can also say this affects removing items also. If there is less then 3 items the items are not removed.

Comment by md_5 [ 01/Dec/16 ]

Right so this is complicated issue whereby empty item stacks are now (correctly imo) treated by Mojang as air. Unfortunately this bug was previously masked by the fact they are not.
This issue only occurs when the ItemStack concerned is of stack size 1.
Possibly the best workaround is to only reduce the contents of the inventory after the event is called, but that probably breaks someone else's workflow and is a fairly large change.

Comment by md_5 [ 30/Nov/16 ]

Cannot reproduce firing stone out of a dispenser.
Is there a specific item or items this happens with? This sort of info is critical when reporting issues....

Generated at Sat Dec 13 18:59:54 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.