Help with enchantments

Discussion in 'Plugin Development' started by roflcopter399, Sep 22, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    roflcopter399

    Ok, so I know all about the custom crafting recipes for bukkit, but I was wondering if that when u craft an item, you can give it an enchant. For example:
    Code:
    ShapedRecipe f1enchant = new ShapedRecipe(new ItemStack(Material.DIAMOND_SWORD, 1)).shape("  ", " *%* ", "  ").setIngredient('*', Material.STONE).setIngredient('%', Material.COBBLESTONE);
    I was wondering if it was possible to add an enchantment to that Diamond Sword when the person crafts it.
     
  2. Offline

    zippy120

    Try this:

    Code:
    ShapedRecipe f1enchant = new ShapedRecipe(new ItemStack(Material.DIAMOND_SWORD, 1).addEnchantment(/*Enchantment*/))
    .shape("  ", " *%* ", "  ")
    .setIngredient('*', Material.STONE)
    .setIngredient('%', Material.COBBLESTONE);
    
     
Thread Status:
Not open for further replies.

Share This Page