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

Cannot add Items to custom Cartography Inventory neither by dragging nor via code. Map View doesn't work.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version 3937-Spigot-dba3cdc-864f616 (MC: 1.20.2) (Implementing API version 1.20.2-R0.1-SNAPSHOT)
    • -
    • Yes

      I created a new Inventory of type InventoryType.CARTOGRAPHY with 

      Inventory inventory = Bukkit.createInventory(player, InventoryType.CARTOGRAPHY);

      and showed it to the player using

      player.openInventory(inventory);

      There are several things that do not work:

      • I cannot set items using inventory.setItem()
      • If I drag-click items into slot 0 or 1 they just disappear and get removed from the cursor (See attachment)
      • If I add a filled map into slot 0 (by clicking on it, not via code, as this doesn't work) no image is shown.

      If I place a cartography table on the ground and use it's Inventory things work as usual.

       

      Sourcecode:

      public final class CustomInventoryTest extends JavaPlugin implements Listener {
          @Override
          public void onEnable() {
              this.getServer().getPluginManager().registerEvents(this, this);
          }
      
          @EventHandler
          public void on(PlayerJoinEvent event) {
              Player player = event.getPlayer();
              Inventory inventory = Bukkit.createInventory(player, InventoryType.CARTOGRAPHY);
              inventory.setItem(1, new ItemStack(Material.PAPER));
              player.openInventory(inventory);
          }
      }
      

       

      Things I tried:

      • Open the Inventory with a delay
      • Adding the Item after opening the Inventory
      • Adding the Item with a delay
      • Adding Items (also with different Materials) to other slots
      • Creating the Inventory without an InventoryHolder

            Unassigned Unassigned
            Placeblock Felix W
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: