Need help about item damaging

Discussion in 'Plugin Development' started by Xarik, Nov 18, 2011.

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

    Xarik

    Hi,

    Sorry if this question was already posted, but i've searched the forum and not found any answer to my problem.

    My problem is i need to cancel the onBlockBreak event, but when i do that the tool i use to break the blocks are not damaged, on client-side the lifebar of the tool down progressively to red, but when in normal time the item disapear, here the item regain full-life

    So my question is: how i can damage an item and destroy it after it's number of uses ?

    I look setDamage() function but apparently the damage is to define what does the item and not the damage he suffers.


    PS: Sorry for my bad english

    Ok i've found the solution, the durability of an item (if is a tool) is the number of times it was used.

    So, in my onBlockBreak function i set the durability of the item (if a tool) and i check the number of use if the number is the max for the material i remove the item from player inventory.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 21, 2016
  2. Offline

    undeadmach1ne

    you can setDurability(); just make sure you use + numbers.
     
Thread Status:
Not open for further replies.

Share This Page