From 82cf576315155e6d5a7fde0be198c1fe37406764 Mon Sep 17 00:00:00 2001 From: j502647092 Date: Sat, 24 Oct 2015 17:58:31 +0800 Subject: [PATCH] put item to inv while player use... Signed-off-by: j502647092 --- .../cn/citycraft/ProtectItem/listen/ItemHeldListen.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/cn/citycraft/ProtectItem/listen/ItemHeldListen.java b/src/main/java/cn/citycraft/ProtectItem/listen/ItemHeldListen.java index a902dab..161ea5f 100644 --- a/src/main/java/cn/citycraft/ProtectItem/listen/ItemHeldListen.java +++ b/src/main/java/cn/citycraft/ProtectItem/listen/ItemHeldListen.java @@ -1,5 +1,6 @@ package cn.citycraft.ProtectItem.listen; +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -23,6 +24,9 @@ public class ItemHeldListen implements Listener { final Inventory inv = p.getInventory(); final int slot = e.getNewSlot(); final ItemStack i = inv.getItem(slot); - e.setCancelled(plugin.actionCheck(p, i, ActionType.Held)); + if (plugin.actionCheck(p, i, ActionType.Held)) { + inv.setItem(slot, new ItemStack(Material.AIR)); + } + inv.addItem(i); } }