mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 02:17:35 +01:00
SPIGOT-3674: Take into account max stack size for PlayerDropItemEvent
This commit is contained in:
parent
809c399a62
commit
22564a9177
@ -94,7 +94,7 @@
|
|||||||
+ if (flag1 && (cur == null || cur.getAmount() == 0)) {
|
+ if (flag1 && (cur == null || cur.getAmount() == 0)) {
|
||||||
+ // The complete stack was dropped
|
+ // The complete stack was dropped
|
||||||
+ player.getInventory().setItemInHand(drop.getItemStack());
|
+ 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
|
+ // Only one item is dropped
|
||||||
+ cur.setAmount(cur.getAmount() + 1);
|
+ cur.setAmount(cur.getAmount() + 1);
|
||||||
+ player.getInventory().setItemInHand(cur);
|
+ player.getInventory().setItemInHand(cur);
|
||||||
|
Loading…
Reference in New Issue
Block a user