Solved Reduce durability

Discussion in 'Plugin Development' started by VENTO, Dec 28, 2016.

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

    VENTO

    Hello everybody.

    I'm trying to reduce durability of golden chest on player - but the durability increases!
    I have tried everything and I don't know how to solve it.

    My code:
    Code:
    int durability = p.getInventory().getChestplate().getDurability() - 1;
    p.getInventory().setChestplate(new ItemStack(Items.WalkerGuts, 1, (short) durability));
    
     
  2. Offline

    Zombie_Striker

    @VENTO
    Durability does not start at the highest integer. Undamaged items have 0 durability. Broken items have higher numbers. Instead of subtracting, add +1 to the durability.
     
  3. Offline

    VENTO

    Oh, yeah! Thanks a lot.
    Solved.
     
Thread Status:
Not open for further replies.

Share This Page