public static void addStoredEnchantment(ItemStack item, Integer enchantment, Integer level, boolean ignoreLevelRestriction) { if (item == null) { return; } ItemMeta itemMeta = item.getItemMeta(); if (itemMeta == null) { return; } if (itemMeta instanceof EnchantmentStorageMeta) { EnchantmentStorageMeta storageMeta = (EnchantmentStorageMeta)itemMeta; storageMeta.addStoredEnchant(new EnchantmentWrapper(enchantment), level, ignoreLevelRestriction); item.setItemMeta(storageMeta); } }
public ItemStack getItemStack(PlayerInfo playerInfo, String challengeName) { Challenge challenge = getChallenge(challengeName); ChallengeCompletion completion = playerInfo.getChallenge(challengeName); ItemStack currentChallengeItem = challenge.getDisplayItem(completion, defaults.enableEconomyPlugin); ItemMeta meta = currentChallengeItem.getItemMeta(); List<String> lores = meta.getLore(); if (challenge.isRepeatable() || completion.getTimesCompleted() == 0) { lores.add(tr("\u00a7e\u00a7lClick to complete this challenge.")); } else { lores.add(tr("\u00a74\u00a7lYou can't repeat this challenge.")); } if (completion.getTimesCompleted() > 0) { meta.addEnchant(new EnchantmentWrapper(0), 0, true); } meta.setLore(lores); currentChallengeItem.setItemMeta(meta); return currentChallengeItem; }
public static ItemStack redstoneApple() { ItemStack itemStack = new ItemStack(Material.APPLE, 1, (short) 1000); ItemMeta itemMeta = itemStack.getItemMeta(); itemMeta.setDisplayName("Redstone Apple"); /**ADD LORE**/ ArrayList<String> lore = new ArrayList<String>(); lore.add(ChatColor.GREEN + "Used to make Redstone Activators!"); lore.add(ChatColor.GREEN + "A stomach full of redstone!"); itemMeta.setLore(lore); Enchantment enchantment = new EnchantmentWrapper(34); itemMeta.addEnchant(enchantment, 1, true); itemStack.setItemMeta(itemMeta); return itemStack; }
@Override public boolean conflictsWith(Enchantment other) { if (other instanceof EnchantmentWrapper) { other = ((EnchantmentWrapper) other).getEnchantment(); } if (!(other instanceof CraftEnchantment)) { return false; } CraftEnchantment ench = (CraftEnchantment) other; return !target.canApplyTogether(ench.target); }
@Override public boolean conflictsWith(Enchantment other) { if (other.getClass().equals(EnchantmentWrapper.class)) { other = ((EnchantmentWrapper) other).getEnchantment(); } if (!(other.getClass().equals(CraftEnchantment.class))) { return false; } CraftEnchantment ench = (CraftEnchantment) other; return !target.canApplyTogether(ench.target); }
public static net.minecraft.server.Enchantment getRaw(Enchantment enchantment) { if (enchantment instanceof EnchantmentWrapper) { enchantment = ((EnchantmentWrapper) enchantment).getEnchantment(); } if (enchantment instanceof CraftEnchantment) { return ((CraftEnchantment) enchantment).target; } return null; }
@Override public boolean conflictsWith(Enchantment other) { if (other instanceof EnchantmentWrapper) { other = ((EnchantmentWrapper) other).getEnchantment(); } if (!(other instanceof CraftEnchantment)) { return false; } CraftEnchantment ench = (CraftEnchantment) other; return !target.a(ench.target); }
public static ItemStack redstoneActivator() { ItemStack itemStack = new ItemStack(Material.REDSTONE_BLOCK, 1); ItemMeta itemMeta = itemStack.getItemMeta(); itemMeta.setDisplayName("Redstone Activator"); /**ADD LORE**/ ArrayList<String> lore = new ArrayList<String>(); lore.add(ChatColor.GREEN + "Used to activate Redstone CPUs!"); itemMeta.setLore(lore); Enchantment DDR = new EnchantmentWrapper(34); itemMeta.addEnchant(DDR, 1, true); itemStack.setItemMeta(itemMeta); return itemStack; }
public static ItemStack typifier() { ItemStack itemStack = new ItemStack(Material.BLAZE_ROD, 1, (short) 1000); ItemMeta itemMeta = itemStack.getItemMeta(); itemMeta.setDisplayName("Typifier"); /**ADD LORE**/ ArrayList<String> lore = new ArrayList<String>(); lore.add(ChatColor.GREEN + "Create CPUs!"); lore.add(ChatColor.GREEN + "Loop through types!"); itemMeta.setLore(lore); Enchantment enchantment = new EnchantmentWrapper(34); itemMeta.addEnchant(enchantment, 1, true); itemStack.setItemMeta(itemMeta); return itemStack; }
@Override public boolean conflictsWith(Enchantment other) { if (other instanceof EnchantmentWrapper) { other = ((EnchantmentWrapper) other).getEnchantment(); } if (!(other instanceof CraftEnchantment)) { return false; } CraftEnchantment ench = (CraftEnchantment) other; return !target.func_77326_a(ench.target); }