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) {
for (Map.Entry<Integer, ItemStack> entry : overflow.entrySet()) {
ItemStack stack = entry.getValue();
Item dropped = player.getWorld().dropItem(player.getLocation(), stack);
PlayerDropItemEvent event = new PlayerDropItemEvent(player, dropped);
if (event.isCancelled()) {
dropped.remove();
if (stack.getType() != Material.AIR && stack.getAmount() > 0) {
Item dropped = player.getWorld().dropItem(player.getLocation(), stack);
PlayerDropItemEvent event = new PlayerDropItemEvent(player, dropped);
if (event.isCancelled()) {
dropped.remove();
}
}
}
}