[SPIGOT-6552] Some inventory types reset cursor on switch Created: 14/Jun/21 Updated: 30/Jul/21 Resolved: 30/Jul/21 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | HexedHero | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | cursor, inventory, reset |
Version: | This server is running CraftBukkit version 3137-Spigot-66f9d3c-85b8c1f (MC: 1.17) (Implementing API version 1.17-R0.1-SNAPSHOT) |
Guidelines Read: | Yes |
Description |
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); }
|
Comments |
Comment by Marvin Rieple [ 29/Jul/21 ] |
Made a PR for this: craftbukkit#903 |
Comment by md_5 [ 14/Jun/21 ] |
I'm surprised switching between chests does not trigger this, though I suspect there is at least some chance this is a client issue and unavoidable (held item is now stored in the active container). Testing with some minimal packets would help confirm this. |