From 18c71453ce24600604c82ff0dd3bc057d60c3793 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 19 Mar 2018 16:06:34 +1100 Subject: [PATCH] Fix item drop issue on older spigot versions --- .../java/com/sk89q/worldedit/bukkit/BukkitPlayer.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 5e959f13..8a192ed1 100644 --- a/bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -140,10 +140,12 @@ public class BukkitPlayer extends LocalPlayer { public void run(Object value) { for (Map.Entry 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(); + } } } }