From f588d1103f829dac26a1969fb4354c293828f214 Mon Sep 17 00:00:00 2001 From: Felix Cravic Date: Sun, 17 May 2020 11:44:34 +0200 Subject: [PATCH] Fix cursor item dropping when drop event is cancelled --- src/main/java/net/minestom/server/entity/Player.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minestom/server/entity/Player.java b/src/main/java/net/minestom/server/entity/Player.java index afd25b2ff..9a2ad0093 100644 --- a/src/main/java/net/minestom/server/entity/Player.java +++ b/src/main/java/net/minestom/server/entity/Player.java @@ -952,7 +952,10 @@ public class Player extends LivingEntity { cursorItem = openInventory.getCursorItem(this); } if (!cursorItem.isAir()) { - dropItem(cursorItem); + // Add item to inventory if he hasn't been able to drop it + if (!dropItem(cursorItem)) { + getInventory().addItemStack(cursorItem); + } } CloseWindowPacket closeWindowPacket = new CloseWindowPacket();