-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
-
None
Well I noticed there is no way for getting the event where a players' inventory is updated.
There could be plenty of reasons for an inventory to update:
- An inventoryholder pickups an item
- A player drags an item into his inventory
- Another plugin updates the inventory (Adding item, removing item, clearing inventory)
- A player drops an item
- A dispenser equips armor on a player
- A dispenser gives something to the player
- A player drags an item into another inventory
- Items enter a hopper
- Items are transmitted from a hopper
- InventoryHolder dies
I suggest to put all these in an InventoryUpdateEvent, which would have the following arguments:
Inventory getInventory() - the inventory updated
UpdateType getUpdateType() - the way the inventory was updated (An enum with ways of an inventory being updated)
InventoryHolder getSource() - who updated the inventory (I dont know if this should be an inventoryholder since it can be a plugin aswell)
InventoryType getInventoryType() - the inventory that was updated's type
And another event, PlayerInventoryUpdateEvent which extends InventoryUpdateEvent:
Player getPlayer() - the player who's inventory was updated
And all the variables from InventoryUpdateEvent
Now, of course these are all listenable - I can listen for pickup, dragging, clicking, dispensing, death and all that stuff, but I cannot listen for another plugin updating an inventory. That is a major flaw in bukkit & spigot and I think spigot is the place to change it.
- is duplicated by
-
SPIGOT-1434 InventoryChangeEvent
- Resolved