Saving Itemstack to a file? (from hashmap)

Discussion in 'Plugin Development' started by recon88, Jun 3, 2012.

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

    recon88

    Since Iteamstack is not serializable, I need a workaround.

    This contains the armor slots of each player(name):
    Code:
    public static HashMap<String, ItemStack[]> armorcontent = new HashMap<String, ItemStack[]>();
    Now, how can I "deserialize?" and save this to a file when the server is shutting down?
    Also I need to load it back to the hashmap after starting up the server.
    Or is there another way without the hashmap?
     
  2. Offline

    Njol

    NuclearW likes this.
  3. Offline

    recon88

    Wow... I don't get it.
    Tried it several times with that class, but it doesn't work.
     
  4. Offline

    LucasEmanuel

    What doesnt work? Just save a HashMap of this type:
    Code:java
    1. HashMap<String, ArrayList<CardboardBox>>


    To create a new CardboardBox:
    Code:java
    1. CardboardBox box = new Cardboardbox(itemstack);
     
Thread Status:
Not open for further replies.

Share This Page