Inventory For Every Player

Discussion in 'Spigot Plugin Development' started by bmac20, May 1, 2017.

  1. Hello, I'm still learning the basics of Java using objects and stuff, but how would i create a separate inventory for each player. I know I could use a hashmap with the player and the inventory but is there another way?
     
  2. You have to store the Player an the associated Inventory. What is better than a HashMap here?
    Two separate Lists? I don't think so.
     
  3. http://xyproblem.info/
    Maybe use the same inventory for more than one player?
     
  4. I would use a hashmap to store an inventory object as the value for each player as the key.
     
  5. You can do this by simply using a Map, also a custom Object to store the player inventory and armor.