Fix item drop issue on older spigot versions

This commit is contained in:
Jesse Boyd 2018-03-19 16:06:34 +11:00
parent ae3981cebf
commit 18c71453ce
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -140,10 +140,12 @@ public class BukkitPlayer extends LocalPlayer {
public void run(Object value) { public void run(Object value) {
for (Map.Entry<Integer, ItemStack> entry : overflow.entrySet()) { for (Map.Entry<Integer, ItemStack> entry : overflow.entrySet()) {
ItemStack stack = entry.getValue(); ItemStack stack = entry.getValue();
Item dropped = player.getWorld().dropItem(player.getLocation(), stack); if (stack.getType() != Material.AIR && stack.getAmount() > 0) {
PlayerDropItemEvent event = new PlayerDropItemEvent(player, dropped); Item dropped = player.getWorld().dropItem(player.getLocation(), stack);
if (event.isCancelled()) { PlayerDropItemEvent event = new PlayerDropItemEvent(player, dropped);
dropped.remove(); if (event.isCancelled()) {
dropped.remove();
}
} }
} }
} }