From 063a4dc3927781f3a2e7508fd92138280f8ac807 Mon Sep 17 00:00:00 2001 From: iam4722202468 Date: Tue, 31 Aug 2021 03:45:54 -0400 Subject: [PATCH] Fix cursor item not being set properly when inventory click event is cancelled --- .../java/net/minestom/server/listener/WindowListener.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minestom/server/listener/WindowListener.java b/src/main/java/net/minestom/server/listener/WindowListener.java index b84420504..2ac80cd70 100644 --- a/src/main/java/net/minestom/server/listener/WindowListener.java +++ b/src/main/java/net/minestom/server/listener/WindowListener.java @@ -66,8 +66,6 @@ public class WindowListener { successful = inventory.doubleClick(player, slot); } - // Prevent the player from picking a ghost item in cursor - refreshCursorItem(player, inventory); // Prevent ghost item when the click is cancelled if (!successful) { player.getInventory().update(); @@ -75,6 +73,10 @@ public class WindowListener { ((Inventory) inventory).update(player); } } + + // Prevent the player from picking a ghost item in cursor + refreshCursorItem(player, inventory); + // (Why is the ping packet necessary?) PingPacket pingPacket = new PingPacket(); pingPacket.id = (1 << 30) | (windowId << 16);