Getting true item data/damage

Discussion in 'Plugin Development' started by Zelnehlun, Mar 8, 2012.

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

    Zelnehlun

    Hello Bukkit Community,
    I have encountered a problem, maybe I am just blind, but I need to get the true data/damage value of an item.

    Which means if the player is holding some kind of dye for example I need the data value which is done with item.getData().getData() or item.getDurability().
    Now if the player is holding for exmaple an iron sword and I call getData() at the beginning it returns 0, after the player used the sword getData() and getDurability() both return 1 (after 1 hit).

    The issue is I need a damage value of the item which does not change when the durability changes, is this possible?
     
  2. Offline

    nisovin

    The damage value of a sword is used for the durability, so you can't use it for anything else. It is somewhat possible to record data onto a sword by using usafe enchantments, though I'm not sure how well that actually works. I know some people have tried in the past and were at least somewhat successful, so it's something you can try.
     
  3. Offline

    Zelnehlun

    Hm I prefer a well working system which is not based on "unsafe enchantments" which sounds like a big workaround but thanks for your fast answer ! :D
     
Thread Status:
Not open for further replies.

Share This Page