Armor Durability

Discussion in 'Plugin Development' started by Ahniolator, Sep 15, 2011.

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

    Ahniolator

    As of now, I've got it so when certain conditions are met, the armor that a player is wearing gets damaged, but even when the durability hits the minimum amount, the armor doesn't break until the player actually takes damage. Is it possible to break player armor once the armor should be broken?

    Btw, I'm using .setDurability() to simulate damage if anyone is wondering.
     
  2. You could check if getDurability <= 0 after each setting and if so, remove it from the players inventory. ;)
     
  3. Offline

    Ahniolator

    You know, that's what I thought too, but when you calculate the damage for a piece of armor you have to add to it :/

    Ex:
    Code:
    inv.getBoots().setDurability((short) (inv.getHelmet().getDurability() + 1));
    Unless I'm misunderstanding my own code :p
     
  4. Okay, so
    Code:
    if(inv.getBoots().getDurability() > x)
    {
      // Remove the boots...
    }
    Where x is the max. durability for that type of armor... ;)
     
Thread Status:
Not open for further replies.

Share This Page