[Solved]MaterialData - saving into MySQL

Discussion in 'Plugin Development' started by agd555, Aug 7, 2012.

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

    agd555

    Hi, i have a problem with saving ItemStack to database. I need to save item durability, enchantments, amounts, and it isn't hard, but there is one thing left - type (e.g. color of wool, type of wood).
    Is there any way to do it? I want to use it to saving virtual chest into db, then loading it.
    I think ItemStack.getData can do it, but i don't have idea how to save it.
     
  2. Offline

    Njol

    Use itemstack.getDurability().
     
    agd555 likes this.
  3. Offline

    agd555

    Can you explain why? getDurability returns damage/durability of item, isn't it?
     
  4. Offline

    Njol

    Yes, and getData() returns a MaterialData object based on the item type and this value, e.g. a ladder returns a Ladder instance which can be used to easily change the data without having to bother about the exact values.
     
    agd555 likes this.
  5. Offline

    agd555

    Okay then, thanks for help!
     
Thread Status:
Not open for further replies.

Share This Page