[SPIGOT-3276] Removing an explicit ItemStack of an Inventory Created: 28/May/17 Updated: 28/May/17 Resolved: 28/May/17 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | New Feature | Priority: | Minor |
Reporter: | Hannes | Assignee: | Unassigned |
Resolution: | Done | Votes: | 0 |
Labels: | Inventory, itemstack, removal |
Description |
Hey, im really missing a method where you can remove an explicit ItemStack from an Inventory Describing this in my problem A User clicks an ItemStack the InventoryInteractEvent getting called transfer a copy of the ItemStack into an other Inventory an when i now try to remove this ItemStack ive Clicked with inventory.remove(itemStack); its remove every Item which are the same e.g 2 Stack Stone , clicking one 2 getting removed and the Method using the int doesent work inventory.remove(event.getSlot()); or inventory.remove(event.getRawSlot()); Doesent remove any ItemStack |
Comments |
Comment by md_5 [ 28/May/17 ] |
I think blab is right about a slot based approach being the correct one. |
Comment by blablubbabc [ 28/May/17 ] |
The remove methods you are using are for removing all itemstacks matching the given item stack / given material id. You can find the javadocs for Inventory here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/Inventory.html You can get the clicked item slot from the InventoryClickEvent and the use that to clear that slot with inventory.clear(slotId). |