• Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • This server is running CraftBukkit version 3137-Spigot-66f9d3c-85b8c1f (MC: 1.17) (Implementing API version 1.17-R0.1-SNAPSHOT)
    • Yes

      When the player has a chest inventory type open and you player#openInventory another chest inventory type, it will not reset the player's cursor, however, if you use the dispenser inventory type for example it will!

       

      Works fine:

       

          @EventHandler(priority = EventPriority.LOWEST)
          public void a(BlockBreakEvent event)
          {
              final Inventory inv1 = Bukkit.createInventory(null, InventoryType.CHEST);
              inv1.addItem(new ItemStack(Material.ACACIA_BOAT));        final Inventory inv2 = Bukkit.createInventory(null, InventoryType.CHEST);
              inv2.addItem(new ItemStack(Material.ANDESITE));        event.getPlayer().openInventory(inv1);        Bukkit.getScheduler().runTaskLater(DevTest.getInstance(), () -> {            event.getPlayer().openInventory(inv2);        }, 60);
          }
      

       

      Doesn't work and resets the player's cursor.

       

          @EventHandler(priority = EventPriority.LOWEST)
          public void b(BlockPlaceEvent event)
          {
              final Inventory inv1 = Bukkit.createInventory(null, InventoryType.DISPENSER);
              inv1.addItem(new ItemStack(Material.ACACIA_BOAT));        final Inventory inv2 = Bukkit.createInventory(null, InventoryType.DISPENSER);
              inv2.addItem(new ItemStack(Material.ANDESITE));        event.getPlayer().openInventory(inv1);        Bukkit.getScheduler().runTaskLater(DevTest.getInstance(), () -> {            event.getPlayer().openInventory(inv2);        }, 60);
          }
      

       

            Assignee:
            Unassigned
            Reporter:
            HexedHero
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: