mirror of
https://e.coding.net/circlecloud/ProtectItem.git
synced 2024-12-27 20:48:51 +00:00
put item to inv while player use...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
ed0a16fe85
commit
82cf576315
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user