public void drop(String dropped) { int[] pair = {row, col}; String takeItem = null; for (String item : inventory) { if (item.equals(dropped)) { takeItem = item; } } if (takeItem != null) { inventory.remove(takeItem); myMap.addItems(pair, takeItem); txtTranscript.insert( "You dropped a \"" + takeItem + "\".\n", txtTranscript.getText().length()); } else { txtTranscript.insert( "You aren't carrying a \"" + dropped + "\" to drop.\n", txtTranscript.getText().length()); } autoinventory(); }