Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-2731

Fire InventoryMoveItemEvent cancelled without move

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None

      Currently the InventoryMoveItemEvent is fired every time a Hopper or Dropper tries to move an item into another inventory, even when the destination inventory is full and the Vanilla action would be to not transfer items at all. There is no way for a plugin to know if the move actually occurred or if it was only an attempt of a move.

      This also poses performance issues with protection plugins like LWC as they need to check every move for block protections. E.g. in storage systems where hoppers point into full chests. Every hopper-transfer-rate tick the event is fired.

      Two possible solutions:

      • Fire the event as cancelled (like the PlayerInteractEvent for example) so that pure protection plugins can simply ignore these cancelled events
      • Don't fire the event when the destination inventory is full and the Vanilla behaviour would be to not transfer items at all (not the best solution as it could break existing plugins and would not go in line with Bukkit's doc)

            Unassigned Unassigned
            Phoenix616 Phoenix616
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: