"Drop Item" and "Inventory Search" Methods Aren't Working
I am working on a game in BlueJ and I am trying to add a "drop" and "items" command in order to drop an item and see a list of the player's current inventory. However, when I use either command in the game it results in a "nullpointerexception" error message. The "take" method is very similar to the "drop" method but it works so I am unsure what is happening. I have attached screenshots which show the methods being used in the Game class and the error in the Player class.
Re: "Drop Item" and "Inventory Search" Methods Aren't Working
It may be a problem to do with the removeItem() method. Could you post the full error log please?