Search in sources :

Example 91 with Inventory

use of org.bukkit.inventory.Inventory in project EliteMobs by MagmaGuy.

the class CustomShopMenu method customShopConstructor.

/**
 * Creates a new instance of a custom shop
 *
 * @param player Player for whom the new menu will show up
 */
public static void customShopConstructor(Player player) {
    Inventory shopInventory = Bukkit.createInventory(player, 54, SHOP_NAME);
    populateShop(shopInventory, player);
    player.openInventory(shopInventory);
}
Also used : Inventory(org.bukkit.inventory.Inventory)

Example 92 with Inventory

use of org.bukkit.inventory.Inventory in project EliteMobs by MagmaGuy.

the class EnhancementMenu method constructEnhancementMenu.

/**
 * Creates a menu for scrapping elitemobs items. Only special Elite Mob items can be scrapped here.
 *
 * @param player Player for whom the inventory will be created
 */
public void constructEnhancementMenu(Player player) {
    Inventory EnhancementInventory = Bukkit.createInventory(player, 54, EnhancementMenuConfig.shopName);
    for (int i = 0; i < EnhancementInventory.getSize(); i++) {
        if (i == EnhancementMenuConfig.infoSlot) {
            EnhancementInventory.setItem(i, EnhancementMenuConfig.infoButton);
            continue;
        }
        if (i == EnhancementMenuConfig.cancelSlot) {
            EnhancementInventory.setItem(i, EnhancementMenuConfig.cancelButton);
            continue;
        }
        if (i == eliteItemInformationInputSlot) {
            EnhancementInventory.setItem(i, EnhancementMenuConfig.eliteItemInputInfoButton);
            continue;
        }
        if (i == eliteScrapInformationInputSlot) {
            EnhancementInventory.setItem(i, EnhancementMenuConfig.eliteUpgradeOrbInputInfoButton);
            continue;
        }
        if (i == informationOutputSlot) {
            EnhancementInventory.setItem(i, EnhancementMenuConfig.outputInfoButton);
            continue;
        }
        if (i == EnhancementMenuConfig.confirmSlot) {
            ItemStack clonedConfirmButton = EnhancementMenuConfig.confirmButton.clone();
            List<String> lore = new ArrayList<>();
            for (String string : EnhancementMenuConfig.confirmButton.getItemMeta().getLore()) lore.add(string);
            EnhancementMenuConfig.confirmButton.getItemMeta().setLore(lore);
            ItemMeta clonedMeta = clonedConfirmButton.getItemMeta();
            clonedMeta.setLore(lore);
            clonedConfirmButton.setItemMeta(clonedMeta);
            EnhancementInventory.setItem(i, clonedConfirmButton);
            continue;
        }
        if (i == EnhancementMenuConfig.eliteItemInputSlot || i == EnhancementMenuConfig.eliteUpgradeOrbInputSlot || i == EnhancementMenuConfig.outputSlot)
            continue;
        EnhancementInventory.setItem(i, ItemStackGenerator.generateItemStack(Material.GLASS_PANE));
    }
    player.openInventory(EnhancementInventory);
    createEliteMenu(player, EnhancementInventory, inventories);
}
Also used : ArrayList(java.util.ArrayList) ItemStack(org.bukkit.inventory.ItemStack) Inventory(org.bukkit.inventory.Inventory) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 93 with Inventory

use of org.bukkit.inventory.Inventory in project EliteMobs by MagmaGuy.

the class ScrapperMenu method constructScrapMenu.

/**
 * Creates a menu for scrapping elitemobs items. Only special Elite Mob items can be scrapped here.
 *
 * @param player Player for whom the inventory will be created
 */
public void constructScrapMenu(Player player) {
    Inventory scrapInventory = Bukkit.createInventory(player, 54, ScrapperMenuConfig.shopName);
    for (int i = 0; i < 54; i++) {
        if (i == ScrapperMenuConfig.infoSlot) {
            scrapInventory.setItem(i, ScrapperMenuConfig.infoButton);
            continue;
        }
        if (i == ScrapperMenuConfig.cancelSlot) {
            scrapInventory.setItem(i, ScrapperMenuConfig.cancelButton);
            continue;
        }
        if (i == ScrapperMenuConfig.confirmSlot) {
            ItemStack clonedConfirmButton = ScrapperMenuConfig.confirmButton.clone();
            List<String> lore = new ArrayList<>();
            for (String string : ScrapperMenuConfig.confirmButton.getItemMeta().getLore()) lore.add(string);
            ScrapperMenuConfig.confirmButton.getItemMeta().setLore(lore);
            ItemMeta clonedMeta = clonedConfirmButton.getItemMeta();
            clonedMeta.setLore(lore);
            clonedConfirmButton.setItemMeta(clonedMeta);
            scrapInventory.setItem(i, clonedConfirmButton);
            continue;
        }
        if (validSlots.contains(i))
            continue;
        scrapInventory.setItem(i, ItemStackGenerator.generateItemStack(Material.GLASS_PANE));
    }
    player.openInventory(scrapInventory);
    createEliteMenu(player, scrapInventory, inventories);
}
Also used : ArrayList(java.util.ArrayList) ItemStack(org.bukkit.inventory.ItemStack) Inventory(org.bukkit.inventory.Inventory) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 94 with Inventory

use of org.bukkit.inventory.Inventory in project EliteMobs by MagmaGuy.

the class UnbindMenu method constructUnbinderMenu.

/**
 * Creates a menu for scrapping elitemobs items. Only special Elite Mob items can be scrapped here.
 *
 * @param player Player for whom the inventory will be created
 */
public void constructUnbinderMenu(Player player) {
    Inventory UnbinderInventory = Bukkit.createInventory(player, 54, UnbinderMenuConfig.getShopName());
    for (int i = 0; i < UnbinderInventory.getSize(); i++) {
        if (i == UnbinderMenuConfig.getInfoSlot()) {
            UnbinderInventory.setItem(i, UnbinderMenuConfig.getInfoButton());
            continue;
        }
        if (i == UnbinderMenuConfig.getCancelSlot()) {
            UnbinderInventory.setItem(i, UnbinderMenuConfig.getCancelButton());
            continue;
        }
        if (i == eliteItemInformationInputSlot) {
            UnbinderInventory.setItem(i, UnbinderMenuConfig.getEliteItemInputInfoButton());
            continue;
        }
        if (i == eliteScrapInformationInputSlot) {
            UnbinderInventory.setItem(i, UnbinderMenuConfig.getEliteUnbindInputInfoButton());
            continue;
        }
        if (i == informationOutputSlot) {
            UnbinderInventory.setItem(i, UnbinderMenuConfig.getOutputInfoButton());
            continue;
        }
        if (i == UnbinderMenuConfig.getConfirmSlot()) {
            ItemStack clonedConfirmButton = UnbinderMenuConfig.getConfirmButton().clone();
            List<String> lore = new ArrayList<>();
            for (String string : UnbinderMenuConfig.getConfirmButton().getItemMeta().getLore()) lore.add(string);
            UnbinderMenuConfig.getConfirmButton().getItemMeta().setLore(lore);
            ItemMeta clonedMeta = clonedConfirmButton.getItemMeta();
            clonedMeta.setLore(lore);
            clonedConfirmButton.setItemMeta(clonedMeta);
            UnbinderInventory.setItem(i, clonedConfirmButton);
            continue;
        }
        if (i == UnbinderMenuConfig.getEliteItemInputSlot() || i == UnbinderMenuConfig.getEliteUnbindInputSlot() || i == UnbinderMenuConfig.getOutputSlot())
            continue;
        UnbinderInventory.setItem(i, ItemStackGenerator.generateItemStack(Material.GLASS_PANE));
    }
    player.openInventory(UnbinderInventory);
    createEliteMenu(player, UnbinderInventory, inventories);
}
Also used : ArrayList(java.util.ArrayList) ItemStack(org.bukkit.inventory.ItemStack) Inventory(org.bukkit.inventory.Inventory) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 95 with Inventory

use of org.bukkit.inventory.Inventory in project EliteMobs by MagmaGuy.

the class BuyOrSellMenu method constructBuyOrSellMenu.

public static void constructBuyOrSellMenu(Player player, ItemStack buyItemStack) {
    Inventory shopInventory = Bukkit.createInventory(player, 18, SHOP_NAME);
    // information item
    shopInventory.setItem(BuyOrSellMenuConfig.INFORMATION_SLOT, BuyOrSellMenuConfig.INFORMATION_ITEM);
    // sell item
    shopInventory.setItem(BuyOrSellMenuConfig.SELL_SLOT, BuyOrSellMenuConfig.SELL_ITEM);
    // buy item
    shopInventory.setItem(BuyOrSellMenuConfig.BUY_SLOT, buyItemStack);
    player.openInventory(shopInventory);
}
Also used : Inventory(org.bukkit.inventory.Inventory)

Aggregations

Inventory (org.bukkit.inventory.Inventory)224 ItemStack (org.bukkit.inventory.ItemStack)132 Player (org.bukkit.entity.Player)80 EventHandler (org.bukkit.event.EventHandler)58 PlayerInventory (org.bukkit.inventory.PlayerInventory)40 ArrayList (java.util.ArrayList)37 ItemMeta (org.bukkit.inventory.meta.ItemMeta)34 InventoryHolder (org.bukkit.inventory.InventoryHolder)25 Block (org.bukkit.block.Block)18 Mage (com.elmakers.mine.bukkit.api.magic.Mage)16 Location (org.bukkit.Location)16 UUID (java.util.UUID)13 HashMap (java.util.HashMap)12 Entity (org.bukkit.entity.Entity)12 Material (org.bukkit.Material)11 HumanEntity (org.bukkit.entity.HumanEntity)10 Vector (org.bukkit.util.Vector)9 Sign (org.bukkit.block.Sign)8 InventoryType (org.bukkit.event.inventory.InventoryType)8 MageController (com.elmakers.mine.bukkit.api.magic.MageController)7