Java Code Examples for org.bukkit.inventory.ItemStack#addEnchantment()
The following examples show how to use
org.bukkit.inventory.ItemStack#addEnchantment() .
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: HasteyBoysListener.java From UhcCore with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onPlayerCraft(CraftItemEvent e){ ItemStack item = e.getCurrentItem(); try { item.addEnchantment(Enchantment.DIG_SPEED,3); item.addEnchantment(Enchantment.DURABILITY,1); }catch (IllegalArgumentException ex){ // Nothing } }
Example 2
Source File: FlagBowspleef.java From HeavySpleef with GNU General Public License v3.0 | 5 votes |
public ItemStack getBowItemstack() { ItemStack stack = new ItemStack(BOW_MATERIAL); stack.addEnchantment(Enchantment.ARROW_INFINITE, 1); ItemMeta meta = stack.getItemMeta(); meta.setDisplayName(getI18N().getString(Messages.Player.BOW)); String lore = getI18N().getString(Messages.Player.BOW_LORE); if (!lore.isEmpty()) { meta.setLore(Lists.newArrayList(lore.split("\n"))); } stack.setItemMeta(meta); return stack; }