Check if item is damageable?

Discussion in 'Plugin Development' started by Tim_M, Nov 19, 2021.

  1. Offline

    Tim_M

    I need to check if item can take damage e.g. Sword, Axe, Fishing Rod etc.
    Or if it can't e.g. stone, enderpearl etc.

    I have tried the following:
    Code:
    item.getItemMeta() instanceof org.bukkit.inventory.meta.Damageable
    
    but it's always true no matter what item I check, any help?
     
  2. Offline

    pixelrider2000

    I havn't looked into that but couldn't you use getDurability()? What does that return for items that don't have any? Just my thoughts, good luck ;)
     

Share This Page