Search in sources :

Example 6 with EliteItemLore

use of com.magmaguy.elitemobs.items.EliteItemLore in project EliteMobs by MagmaGuy.

the class UnbindEnchantment method unbindItem.

public static ItemStack unbindItem(ItemStack itemStack) {
    ItemStack newItemStack = itemStack.clone();
    ItemMeta itemMeta = newItemStack.getItemMeta();
    itemMeta.getPersistentDataContainer().remove(SoulbindEnchantment.SOULBIND_KEY);
    itemMeta.getPersistentDataContainer().remove(SoulbindEnchantment.PRESTIGE_KEY);
    newItemStack.setItemMeta(itemMeta);
    new EliteItemLore(newItemStack, false);
    return newItemStack;
}
Also used : EliteItemLore(com.magmaguy.elitemobs.items.EliteItemLore) ItemStack(org.bukkit.inventory.ItemStack) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 7 with EliteItemLore

use of com.magmaguy.elitemobs.items.EliteItemLore in project EliteMobs by MagmaGuy.

the class SimLootCommand method run.

public static void run(Player player, int level) {
    try {
        ItemStack itemStack = LootTables.generateLoot(level, player.getLocation(), player);
        if (itemStack == null)
            player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getSimlootMessageFailure()));
        else {
            EliteItemLore eliteItemLore = new EliteItemLore(itemStack, false);
            player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getSimlootMessageSuccess().replace("$itemName", eliteItemLore.getItemStack().getItemMeta().getDisplayName())));
        }
    } catch (Exception ex) {
        player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getSimlootMessageFailure()));
    }
}
Also used : EliteItemLore(com.magmaguy.elitemobs.items.EliteItemLore) ItemStack(org.bukkit.inventory.ItemStack)

Example 8 with EliteItemLore

use of com.magmaguy.elitemobs.items.EliteItemLore in project EliteMobs by MagmaGuy.

the class CustomShopMenu method shopContents.

/**
 * Fills with the items to be sold in the shop
 *
 * @param shopInventory Inventory to be filled
 */
private static void shopContents(Inventory shopInventory, Player player) {
    // Anything after 8 is populated
    Random random = new Random();
    for (int i : CustomShopMenuConfig.storeSlots) {
        int itemEntryIndex = random.nextInt(CustomItem.getCustomItemStackShopList().size());
        ItemStack itemStack = CustomItem.getCustomItemStackShopList().get(itemEntryIndex).clone();
        SoulbindEnchantment.addEnchantment(itemStack, player);
        new EliteItemLore(itemStack, true);
        shopInventory.setItem(i, itemStack);
    }
}
Also used : EliteItemLore(com.magmaguy.elitemobs.items.EliteItemLore) Random(java.util.Random) ItemStack(org.bukkit.inventory.ItemStack)

Example 9 with EliteItemLore

use of com.magmaguy.elitemobs.items.EliteItemLore in project EliteMobs by MagmaGuy.

the class ItemConstructor method commonFeatures.

private static ItemStack commonFeatures(ItemStack itemStack, EliteEntity eliteEntity, Player player, HashMap<Enchantment, Integer> enchantments, HashMap<String, Integer> customEnchantments, boolean showItemWorth) {
    ItemMeta itemMeta = itemStack.getItemMeta();
    // hide default lore
    itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
    /*
        Register elite item
         */
    ItemTagger.registerEliteItem(itemMeta);
    /*
        Register item source for lore redraw
         */
    ItemTagger.registerItemSource(eliteEntity, itemMeta);
    // Tag the item
    ItemTagger.registerEnchantments(itemMeta, enchantments);
    ItemTagger.registerCustomEnchantments(itemMeta, customEnchantments);
    itemStack.setItemMeta(itemMeta);
    /*
        Add soulbind if applicable
         */
    SoulbindEnchantment.addEnchantment(itemStack, player);
    /*
        Update lore
         */
    new EliteItemLore(itemStack, showItemWorth);
    return itemStack;
}
Also used : EliteItemLore(com.magmaguy.elitemobs.items.EliteItemLore) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Aggregations

EliteItemLore (com.magmaguy.elitemobs.items.EliteItemLore)9 ItemStack (org.bukkit.inventory.ItemStack)7 ItemMeta (org.bukkit.inventory.meta.ItemMeta)4 Random (java.util.Random)2 Player (org.bukkit.entity.Player)2 EventHandler (org.bukkit.event.EventHandler)2 NamespacedKey (org.bukkit.NamespacedKey)1 Enchantment (org.bukkit.enchantments.Enchantment)1