[SPIGOT-1218] InventoryUpdateEvent Created: 01/Oct/15  Updated: 17/Nov/17

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

Type: New Feature Priority: Minor
Reporter: SL Dev Assignee: Unassigned
Resolution: Unresolved Votes: 6
Labels: inventory, inventory-update, inventoryupdate

Issue Links:
Duplicate
is duplicated by SPIGOT-1434 InventoryChangeEvent Resolved

 Description   

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:

  1. An inventoryholder pickups an item
  2. A player drags an item into his inventory
  3. Another plugin updates the inventory (Adding item, removing item, clearing inventory)
  4. A player drops an item
  5. A dispenser equips armor on a player
  6. A dispenser gives something to the player
  7. A player drags an item into another inventory
  8. Items enter a hopper
  9. Items are transmitted from a hopper
  10. 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.



 Comments   
Comment by KyleD1986 [ 13/Nov/15 ]

It depends on what event you are trying to call this from it might well be you are trying to use an event that doesn't specify the player such the server ping event.

But all you have to do is get the player name and do player.updateinventory, If you are running from an event try Player player = event.getplayer; and then tell it to update.

Comment by SpigotMC [ 01/Oct/15 ]

Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 0 version(s) behind. CraftBukkit is 2 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue.

Generated at Sat Dec 13 15:21:26 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.