[Need Help] Custom Item

Discussion in 'Plugin Development' started by TimDoesGames | timp1, Apr 5, 2014.

Thread Status:
Not open for further replies.
  1. I want to know if it is possible to set the damage of an item??? this is my code

    Code:java
    1. ItemStack Mace = new ItemStack(Material.IRON_AXE, 1);
    2. ArrayList<String> Mace1 = new ArrayList<String>();
    3. Mace1.add(ChatColor.GREEN + "Heavy but powerfull");
    4. ItemMeta im = Mace.getItemMeta();
    5. im.setDisplayName(ChatColor.GRAY + "" + ChatColor.BOLD + "Mace");
    6. im.setLore(Mace1);
    7. Mace.setItemMeta(im);
    8. ((Player)sender).getInventory().addItem(new ItemStack[] { Mace });
    9. sender.sendMessage(ChatColor.GRAY + "Heavy but powerfull");
     
  2. Offline

    Glumpz

    Code:java
    1. ItemStack i = new ItemStack(Material.DIAMOND_SWORD);
    2. i.setDurability(short durability);
     
  3. Offline

    Venexor

    Glumpz I don't think he means durability. He wants to set the damage that the axe could inflict on a user.
    TimDoesGames | timp1 You would need the EntityDamageByEntityEvent (Not sure if this name is correct) and you would need to check if the damage cause is from your axe and if it is, you inflict damage on the target with the damage() method.
     
  4. Offline

    Venexor

Thread Status:
Not open for further replies.

Share This Page