Save Data In Ram

Discussion in 'Spigot Plugin Development' started by qVotka, May 23, 2015.

  1. Hi
    I want to save integers for players in memory. Like
    Notch 2 5 9 4
    SuperMan 5 8 6 3
    Player2 4 4 7 9
    how can I do this.
    (Sorry for my bad english)
  2. Multiple numbers per play or one big one ?
    You could make a hashmap with key the player name or uuid and the value a list of numbers.

    This is basic Java and shouldn't be poste here.
    • Like Like x 1
    • Agree Agree x 1
  3. As Robi said, you can store this in a hashmap. Alternatively, you can create a wrapper object containing the said values. It's up to you on how you want to structure your data storage.
    • Agree Agree x 1
  4. HashMap<Player, Integer, Integer> Items = new HashMap<Player, Integer, Integer>();
    like this ?
  5. No. You should just create a class that stores all this information as @Bolt suggested.
  6. If you're really wanting to do it without a class, use Guava's Table<Object, Object Object>.