title: Zuul Remake in Java HashMap Issue
body: <p>I am doing a piece of coursework in Java using BlueJ. We need to add new features to the text based game, Zuul. I have decided to start working on an inventory and item system. I am having trouble working out the best way to do this so I just winged it. Here is my code. Sorry I haven't gotten round to commenting everything yet. The game compiles but I get an exception in the console when I run the game.</p>
  
  <p>Error:</p>
  
  <pre><code>java.lang.NullPointerException
      at Game.createPlayer(Game.java:15)
      at Game.&lt;init&gt;(Game.java:7)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
      at bluej.runtime.ExecServer$3.run(ExecServer.java:740)
  </code></pre>
  
  <p>Game Class (This is equivalent of the Main class in Java, this is where the game is run from):</p>
  
  <pre><code>import java.util.*;
  
  public class Game
  {
      public Game()
      {
          createPlayer();
          createItems();
      }
  
      private Entity localPlayer;
  
      public void createPlayer(){
          Player localPlayer = new Player("Player Name", 0, 0, 0, 0, 0);
          localPlayer.equipArmour("Helm", armourDB.get("Helm")); // This is where I think I have gone wrong
      }
  
      // Create global hashmap variables
      private HashMap&lt;String, Weapon&gt; weaponsDB;
      private HashMap&lt;String, Armour&gt; armourDB;
      private HashMap&lt;String, Supplement&gt; supplementDB;
  
      public void createItems(){
          // Create weapons
          weaponsDB = new HashMap&lt;String, Weapon&gt;();
  
          Weapon weaponFists = new Weapon("Fists", "Weapon", 0, 0, 0, 0, 0, "Melee");
          Weapon weaponSword = new Weapon("Sword", "Weapon", 0, 0, 0, 0, 0, "Melee");
          Weapon weaponBow = new Weapon("Bow", "Weapon", 0, 0, 0, 0, 0, "Ranged");
          Weapon weaponDagger = new Weapon("Dagger", "Weapon", 0, 0, 0, 0, 0, "Melee");
  
          weaponsDB.put("Fists", weaponFists);
          weaponsDB.put("Sword", weaponSword);
          weaponsDB.put("Bow", weaponBow);
          weaponsDB.put("Dagger", weaponDagger);
  
          // Create armour
          armourDB = new HashMap&lt;String, Armour&gt;();
  
          Armour armourBreastplate = new Armour("Breatplate", "Chest", 0, 0, 0, 0, 0);
          Armour armourHelm = new Armour("Helm", "Head", 0, 0, 0, 0, 0);
  
          armourDB.put("Breastplate", armourBreastplate);
          armourDB.put("Helm", armourHelm);
  
          // Create supplements
          supplementDB = new HashMap&lt;String, Supplement&gt;();
  
          Supplement supplementHealthPotion = new Supplement("Health Potion", 0, 0);
          Supplement supplementPowerPotion = new Supplement("Power Potion", 0, 0);
  
          supplementDB.put("Health Potion", supplementHealthPotion);
          supplementDB.put("Power Potion", supplementPowerPotion);
      }
  }
  </code></pre>
  
  <p>Entity Class (Construction for the player class and enemy class):</p>
  
  <pre><code>import java.util.*;
  
  public class Entity
  {
      private boolean entityStatus;
  
      private String entityName;
      private int entityHealth;
      private int entityPower;
      private int entityHealthRegen;
      private int entityPowerRegen;
      private int entityAttackPower;
  
      private HashMap&lt;String, Armour&gt; entityEquipment;
      private ArrayList&lt;Item&gt; entityInventory;    
  
      public Entity(
          String paramEntityName,
          int paramEntityHealth,
          int paramEntityPower,
          int paramEntityHealthRegen,
          int paramEntityPowerRegen,
          int paramEntityAttackPower)
      {
          entityStatus = true;
  
          entityName = paramEntityName;
          entityHealth = paramEntityHealth;
          entityPower = paramEntityPower;
          entityHealthRegen = paramEntityHealthRegen;
          entityPowerRegen = paramEntityPowerRegen;
          entityAttackPower = paramEntityAttackPower;
  
          entityEquipment = new HashMap&lt;String, Armour&gt;(); // Set all possible equipment slots to null on initial run
          entityEquipment.put("Head", null);
          entityEquipment.put("Shoulders", null);
          entityEquipment.put("Chest", null);
          entityEquipment.put("Hands", null);
          entityEquipment.put("Legs", null);
          entityEquipment.put("Feet", null);
          entityEquipment.put("Weapon", null);
  
          entityInventory = new ArrayList&lt;Item&gt;();
      }
  
      public boolean getEntityStatus(){
          return entityStatus;
      }
  
      public String getEntityName(){
          return entityName;
      }
  
      public int getEntityHealth(){
          return entityHealth;
      }
  
      public int getEntityPower(){
          return entityPower;
      }
  
      public int getEntityHealthRegen(){
          return entityHealthRegen;
      }
  
      public int getEntityPowerRegen(){
          return entityPowerRegen;
      }
  
      public int getEntityAttackPower(){
          return entityAttackPower;
      }
  
      // Equips the player with an item into the equipment slot
      public void equipArmour(String paramEquipmentSlot, Armour paramArmourName){
          entityEquipment.put(paramEquipmentSlot, paramArmourName);
      }
  
      public void printInventory(){
          System.out.println("Something");
      }
  }
  </code></pre>
  
  <p>I think the main problem is that I cannot wrap my head around the use of hashtags, I need to see a live example to see how it works. Can anyone help? If you need anything else from me, let me know.</p>