[SPIGOT-1299] InventoryDragEvent unable to change both cursor and content Created: 18/Nov/15 Updated: 18/Nov/15 |
|
| Status: | Open |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Noisy Cat | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | 1.8, Craftbukkit, Spigot, bug, event | ||
| Environment: |
Craftbukkit/Spigot 1.8.R3 |
||
| Description |
|
In the description of InventoryDragEvent one can read: However, after cancelling the event you are unable to change the cursor contents. From Container.patch, line 78: if (event.getResult() != Result.DENY) { for (Map.Entry<Integer, ItemStack> dslot : draggedSlots.entrySet()) { view.setItem(dslot.getKey(), CraftItemStack.asBukkitCopy(dslot.getValue())); if (playerinventory.getCarried() != null) { playerinventory.setCarried(CraftItemStack.asNMSCopy(event.getCursor())); needsUpdate = true; } } else { playerinventory.setCarried(oldCursor); } There is no way to edit both the contents and cursor during the event execution. The event could set the cursor to event-changed value regardless of event result: if (event.getResult() != Result.DENY) { for (Map.Entry<Integer, ItemStack> dslot : draggedSlots.entrySet()) { view.setItem(dslot.getKey(), CraftItemStack.asBukkitCopy(dslot.getValue())); } else { playerinventory.setCarried(oldCursor); } if (playerinventory.getCarried() != null) { playerinventory.setCarried(CraftItemStack.asNMSCopy(event.getCursor())); needsUpdate = true; } |
| Comments |
| Comment by SpigotMC [ 18/Nov/15 ] |
|
Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 1 version(s) behind. CraftBukkit is 0 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue. |