Saving and loading player inventorys

Discussion in 'Plugin Development' started by johnny boy, Feb 17, 2017.

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

    johnny boy

    Pretty much I need to save and load inventorys into a yaml file. I know how to use YAML but how would I get and save the inventory?
     
  2. Offline

    JanTuck

    Serialize it? Prob to base64

    Written on my mobile device.
     
  3. Offline

    MrGeneralQ


    save()
    1. Loop through the player getContents()
    2. Iterate through the inventory using an for I loop.
    3. Save the items under the int I and get the Items (ItemStack)

    load

    1. Loop through the yml()
    2. Cast the string in the config back to an ItemStack
    3. use the setItem(I, ItemStackHere)
    4. done
     
    timtower likes this.
Thread Status:
Not open for further replies.

Share This Page