1.14.4 Getting, storing, setting NBT tag to item.

Discussion in 'Spigot Plugin Development' started by DomJan, Mar 10, 2020.

  1. I have a problem with items NBT tag. I want to get NBT tag from Item and store it to database. if I want to retrieve an item, the plugin must put a NBT tag from database. This will be used for only one item. Also, what should be the length of the characters in the database table?

    NBT data I get from Item in hand or from the GUI slot.
    #1 DomJan, Mar 10, 2020
    Last edited: Mar 10, 2020
  2. If you're storing custom data, why not use a PersistentDataHolder?
  3. drives_a_ford


    What are you saying exactly?
    Do you want to read the default/MC NBT data?
    Or do you want to identify a custom item with NBT data?
    If the latter is true, then what yPedx said is exactly what you should be using:
  4. Similar principle to backpacks. Items will start from a variety of blocks to different heads with textures, lores, names.
  5. @DomJan did you find an answer to what you were trying to do?
  6. Yeah, I found the solution.
  7. what did you use? and does it save after server reset?
  8. I used Converting itemstack to base64 method. And this hash I have been saved to database(MYSQL or SQLlite).
    When player wants retrieve this item, I using converting Base64 to ItemStack method.