下面列出了怎么用org.bukkit.inventory.EnchantingInventory的API类实例代码及写法,或者点击链接到github查看源代码。
@EventHandler
public void onInventoryClick(InventoryClickEvent e){
Inventory inv = e.getInventory();
ItemStack item = e.getCurrentItem();
if (!unlimitedLapis) return;
if (inv == null || item == null) return;
if (inv instanceof EnchantingInventory){
if (item.getType().equals(lapis.getType())){
e.setCancelled(true);
}else {
e.getInventory().setItem(1, lapis);
}
}
}
@EventHandler
public void openInventoryEvent(InventoryOpenEvent e){
if (!unlimitedLapis) return;
if (e.getInventory() instanceof EnchantingInventory){
e.getInventory().setItem(1, lapis);
}
}
@EventHandler
public void closeInventoryEvent(InventoryCloseEvent e){
if (!unlimitedLapis) return;
if (e.getInventory() instanceof EnchantingInventory){
e.getInventory().setItem(1, null);
}
}