Solved How To Repair A Item?

Discussion in 'Plugin Development' started by hurleyboarder, Feb 4, 2014.

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

    hurleyboarder

    Hi, I have been trying to figure out how to repair a item in hand, but I cant figure it out, if i could get some help that would be awesome.
    CODE:
    Code:java
    1. } else {
    2. if(cmd.getName().equalsIgnoreCase("repair")){
    3. Player Player = (Player) sender;
    4. Player.setItemInHand(new ItemStack(Player.getItemInHand()));


    So ill i'm trying to do is replacing the item in hand with the same item.
     
  2. Offline

    JUSTCAMH


    try this:
    Code:java
    1. if(cmd.getName().equalsIgnoreCase("repair")){
    2. Player Player = (Player) sender;
    3. player.getItemInHand().setDurability((short) 0);
     
  3. Offline

    hurleyboarder

    Thanks Justcamh it worked!
     
Thread Status:
Not open for further replies.

Share This Page