1
0
mirror of https://e.coding.net/circlecloud/ProtectItem.git synced 2024-12-28 20:58:50 +00:00

put item to inv while player use...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-10-24 17:58:31 +08:00
parent ed0a16fe85
commit 82cf576315

View File

@ -1,5 +1,6 @@
package cn.citycraft.ProtectItem.listen; package cn.citycraft.ProtectItem.listen;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -23,6 +24,9 @@ public class ItemHeldListen implements Listener {
final Inventory inv = p.getInventory(); final Inventory inv = p.getInventory();
final int slot = e.getNewSlot(); final int slot = e.getNewSlot();
final ItemStack i = inv.getItem(slot); 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);
} }
} }