Solved HashMap alternative

Discussion in 'Plugin Development' started by ProMCKingz, Feb 8, 2015.

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

    ProMCKingz

    Hey, so I have a hashmap to store whether a player has selected an upgrade or not. If so, then the upgrade takes place, if not it doesn't. There is one problem with this, which is that maps get reset on server reload/restart, which I want to prevent. Is there any way to keep it stored after the reload or any other alternative? I acknowledge the fact that I could somehow store this in a config, however that would be insufficient and possibly laggy. I was wondering if you could save the map values on disable and they would still be valid?
     
  2. Offline

    SuperOriginal

    OnDisable save the hashmap to a file, onEnable reload it into a hashmap.
     
    ProMCKingz and ReadySetPawn like this.
  3. Offline

    ProMCKingz

    @SuperOriginal
    after reloading it onto the hashmap, remove it from the file again?
     
  4. Offline

    ReadySetPawn

    No. It's not going to cause lag by just sitting there.
     
  5. Offline

    SuperOriginal

    @ProMCKingz Well in the event of a server crash the hashmap data would be lost so it would be best to have some data in a file.
     
  6. Offline

    ProMCKingz

Thread Status:
Not open for further replies.

Share This Page