setDurability() does not break the item

Discussion in 'Plugin Development' started by John Cameron, Jul 16, 2013.

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

    John Cameron

    Even when I do i.setDurability((short) 999); [or some big number]
    The item[stick] will not break no matter what!
    So how do I break the item? Also there should be something like i.breakItem() in the api.

    Thanks! [cake]
     
  2. Offline

    Pawnguy7

    Wouldn't that make it further from breaking?

    Try setDurability(0).
     
  3. Nope, it's actually not the durability but the damage. John Cameron set the type of the item to AIR.
     
  4. Offline

    Pawnguy7

    It isn't? Not sure, not having tested it, but to me, durability means how much "health" an item has. Hrm.

    Anyway, from what I have tried, doing some things with air - setting it's name, for example - doesn't work.
     
  5. As stated with durability you really mean how damaged the item is. The greater the value the more the item is damaged and the less health it has. And setting the type to air works.
     
  6. Offline

    Janmm14

    A stick can't break by changing its durability.
     
    Sir_Mr_Bman likes this.
  7. Offline

    MrGermanrain

    cant you make it though that after x amount of hits it gets removed from an inventory?
     
  8. Offline

    John Cameron

    I'm not using a stick, it's an item like a sword, I just added it for no reason :p
     
  9. Offline

    Sir_Mr_Bman

    WORKAROUND :
    You can detect how many times a player uses item x, then a bit of code like this(?):
    uses++
    if(uses >= 3) {
    //Remove item from inventory (can't remember how to do)
     
Thread Status:
Not open for further replies.

Share This Page