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

InventoryMoveItemEvent Holder not instanceof Hopper(-Minecart) for Hopper(-Minecart)

XMLWordPrintable

    • git-Spigot-9a643a6-eb2e657
    • Yes

      I am sorry I found the mistake. As stated in the thread I checked the source, not the destination. Sorry!

       

       

      For a composter and a hopper underneath InventoryMoveItemEvent#getSource#getHolder is not an instance of Hopper

      private Location getHoppersLocation(InventoryHolder holder) {
      if (holder instanceof Hopper)

      { Hopper hopper = (Hopper) holder; return hopper.getLocation().clone(); }

      if (holder instanceof HopperMinecart)

      { HopperMinecart hopperMinecart = (HopperMinecart) holder; return hopperMinecart.getLocation().clone(); }

      new DebugMessage(this.getClass(), plugin, "HOLDER-CLASS = " + holder.getClass().getName());
      return null;
      }

      This method returns null for InventoryMoveItemEvent#getSource#getHolder for me. Output of the debug-message: HOLDER-CLASS = org.bukkit.craftbukkit.v1_14_R1.inventory.CraftBlockInventoryHolder

       

      This is (at least for me) crucial because otherwise I have no other way to get the location and I believe this is a bug.

       

            Unassigned Unassigned
            alex_qp Alex Kingston
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: