Solved How to detect tool in hand

Discussion in 'Spigot Plugin Development' started by astonish01, May 16, 2016.

  1. I'm trying to make a plugin that detects if the durability of the item in the player hand is low, but all items have durability, and I need to detect if the player is holding a tool, but in what I've looked I would have to detect tool by tool, material by material, maybe there is a better way to do it?
     
  2. joehot200

    Supporter

    getInventory(?).getItemInHand()

    .hasDurability()

    Compare strings to exclude types. So check if the item material name contains "sword" to exclude all swords ad "tools" in your code.
     
    • Like Like x 1