mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-02 17:00:41 +01:00
Ensure that the opened inventory is the same before refreshing the cursor item
This commit is contained in:
parent
4eaa15477b
commit
db619243da
@ -12,6 +12,8 @@ import net.minestom.server.network.packet.client.play.ClientWindowConfirmationPa
|
||||
import net.minestom.server.network.packet.server.play.SetSlotPacket;
|
||||
import net.minestom.server.network.packet.server.play.WindowConfirmationPacket;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class WindowListener {
|
||||
|
||||
public static void clickWindowListener(ClientClickWindowPacket packet, Player player) {
|
||||
@ -86,7 +88,9 @@ public class WindowListener {
|
||||
}
|
||||
|
||||
// Prevent the player from picking a ghost item in cursor
|
||||
refreshCursorItem(player, inventory);
|
||||
if (Objects.equals(player.getOpenInventory(), inventory)) {
|
||||
refreshCursorItem(player, inventory);
|
||||
}
|
||||
|
||||
// Prevent ghost item when the click is cancelled
|
||||
if (!successful) {
|
||||
|
Loading…
Reference in New Issue
Block a user