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

Inventory#getLocation is not implemented for container minecarts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None

      CraftInventory#getLocation calls IInventory#getLocation, which is not implemented for EntityMinecartContainer.

        @EventHandler(ignoreCancelled = true)
        public void onInventoryOpen(InventoryOpenEvent event) {
          Inventory inv = event.getInventory();
          Location location;
          try {
            location = inv.getLocation();
          } catch (AbstractMethodError e) {
            System.err.println(new StringBuilder("Caught AbstractMethodError calling Inventory#getLocation on class ")
                .append(inv.getClass().getName())
                .append("\nType: ").append(inv.getType())
                .append("\nTitle: ").append(inv.getTitle())
                .append("\nHolder: ").append(inv.getHolder()));
            return;
          }
        }
      

      Output:

      [Server thread/WARN]: Caught AbstractMethodError calling Inventory#getLocation on class org.bukkit.craftbukkit.v1_9_R1.inventory.CraftInventory
      Type: CHEST
      Title: Minecart with Chest
      Holder: CraftMinecartChest{inventory=org.bukkit.craftbukkit.v1_9_R1.inventory.CraftInventory@22eb6}
      

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

              Created:
              Updated:
              Resolved: