SPIGOT-3674: Take into account max stack size for PlayerDropItemEvent

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2017-12-03 08:55:19 +11:00
parent 48f3ad297b
commit 939f54a01e

View File

@ -94,7 +94,7 @@
+ if (flag1 && (cur == null || cur.getAmount() == 0)) {
+ // The complete stack was dropped
+ player.getInventory().setItemInHand(drop.getItemStack());
+ } else if (flag1 && cur.isSimilar(drop.getItemStack()) && drop.getItemStack().getAmount() == 1) {
+ } else if (flag1 && cur.isSimilar(drop.getItemStack()) && cur.getAmount() < cur.getMaxStackSize() && drop.getItemStack().getAmount() == 1) {
+ // Only one item is dropped
+ cur.setAmount(cur.getAmount() + 1);
+ player.getInventory().setItemInHand(cur);