Fixed bug where Berserk deletes items

when the players inventory is full.

Fixes #1947
This commit is contained in:
TfT_02
2014-04-05 13:13:33 +02:00
parent 037022b175
commit 1c30146491
3 changed files with 7 additions and 2 deletions

View File

@ -332,9 +332,10 @@ public class PlayerListener implements Listener {
}
if ((mcMMOPlayer.isUsingUnarmed() && ItemUtils.isSharable(dropStack)) || mcMMOPlayer.getAbilityMode(AbilityType.BERSERK)) {
event.setCancelled(Unarmed.handleItemPickup(player.getInventory(), drop));
boolean pickupSuccess = Unarmed.handleItemPickup(player.getInventory(), drop);
event.setCancelled(pickupSuccess);
if (event.isCancelled()) {
if (pickupSuccess) {
player.playSound(player.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
player.updateInventory();
return;

View File

@ -69,6 +69,9 @@ public class Unarmed {
nextSlot++;
}
// Inventory is full - cancel the item pickup
return false;
}
else if (firstEmpty != -1) {
drop.remove();