From 9128a175332a46358aca5f95b144f88814321272 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 7 Mar 2018 15:12:37 +1100 Subject: [PATCH] Fixes #936 --- .../sk89q/worldedit/bukkit/BukkitPlayer.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 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 6248b6a3..5e959f13 100644 --- a/bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -24,6 +24,8 @@ import com.boydti.fawe.FaweCache; import com.boydti.fawe.bukkit.FaweBukkit; import com.boydti.fawe.bukkit.block.BrushBoundBaseBlock; import com.boydti.fawe.config.Settings; +import com.boydti.fawe.object.RunnableVal; +import com.boydti.fawe.util.TaskManager; import com.boydti.fawe.wrappers.WorldWrapper; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.*; @@ -133,14 +135,19 @@ public class BukkitPlayer extends LocalPlayer { if (item != null) { HashMap overflow = inv.addItem(item); if (overflow != null && !overflow.isEmpty()) { - 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(); + TaskManager.IMP.sync(new RunnableVal() { + @Override + 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(); + } + } } - } + }); } } player.updateInventory();