Solved Storing player in hashmap

Discussion in 'Plugin Development' started by shades161, Jul 12, 2015.

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

    shades161

    So, I feel like this would be pretty obvious but I've gotten mixed answers from the stuff I have read online. I am making a minigames plugin, and am storing the player and their arena in a hashmap. My question is, is it better to store a player's UUID rather than the player in the hashmap, and just lookup the player UUID?
     
  2. Offline

    1Rogue

  3. Offline

    teej107

    @shades161 Yes for a HashMap. However you can always use a WeakHashMap to store Players as the key with no worries.
     
    shades161 likes this.
  4. Offline

    shades161

    @teej107 Okay, I will use that then. Thank you.
     
  5. Offline

    emericask8ur

    Yes HashMaps are the way to go. I have used it in SideKick for various parts of the Mini Game Side as well as SideKicks economy.

    Code:
    public static HashMap<String, Double> economy = new HashMap<String, Double>();
    
    And even for materials.
    Code:
    public static HashMap<String, Material> items = new HashMap<String, Material>();
    
     
    shades161 likes this.
Thread Status:
Not open for further replies.

Share This Page