org.bukkit.inventory.EnchantingInventory Java Examples

The following examples show how to use org.bukkit.inventory.EnchantingInventory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CutCleanListener.java    From UhcCore with GNU General Public License v3.0 6 votes vote down vote up
@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);
        }
    }
}
 
Example #2
Source File: CutCleanListener.java    From UhcCore with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void openInventoryEvent(InventoryOpenEvent e){
    if (!unlimitedLapis) return;

    if (e.getInventory() instanceof EnchantingInventory){
        e.getInventory().setItem(1, lapis);
    }
}
 
Example #3
Source File: CutCleanListener.java    From UhcCore with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void closeInventoryEvent(InventoryCloseEvent e){
    if (!unlimitedLapis) return;

    if (e.getInventory() instanceof EnchantingInventory){
        e.getInventory().setItem(1, null);
    }
}