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

InventoryHolder is inconsistent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • CraftBukkit version git-Spigot-df0eb25-649921e (MC: 1.14.2) (Implementing API version 1.14.2-R0.1-SNAPSHOT)
    • Yes

      In an InventoryClickEvent listener, if you do:

      e.getClickedInventory().getHolder();

      You get a wide variety of results depending on the block clicked that do not seem consistent:

      • Smoker - org.bukkit.craftbukkit.v1_14_R1.block.CraftSmoker
      • Chest - org.bukkit.craftbukkit.v1_14_R1.block.CraftChest
      • Brewing Stand - org.bukkit.craftbukkit.v1_14_R1.block.CraftBrewingStand
      • Dropper - org.bukkit.craftbukkit.v1_14_R1.block.CraftDropper
      • Hopper - org.bukkit.craftbukkit.v1_14_R1.block.CraftHopper
      • Minecart Hopper - CraftMinecartHopper{inventory=org.bukkit.craftbukkit.v1_14_R1.inventory.CraftInventory@1f2}
      • Stonecutter - null on left slot, CraftPlayer on right
      • Crafting Table - CraftPlayer
      • Cartography Table - null on all slots
      • Anvil - null all slots
      • Loom - null left slots, CraftPlayer right slot
      • Grindstone - null left slots, CraftPlayer right slot
      • etc.

      It looks like some of the 1.14 blocks do not give block references, and also the Anvil too.

      Test plugin:

      public class Test extends JavaPlugin implements Listener {
      
      
          @Override
          public void onEnable(){
              Bukkit.getPluginManager().registerEvents(this, this);
          }
      
      
          @EventHandler
          public void onInventoryClick(InventoryClickEvent e) {
              Bukkit.getLogger().info("DEBUG: you clicked on " + e.getClickedInventory().getHolder());
          }
      }
      

            Unassigned Unassigned
            tastybento tastybento
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: