@Override
	public void actionPerformed(ActionEvent e) {
		if(orderItems.containsKey(e.getSource())) {
			Orders order = orderItems.get(e.getSource());
			if(GameManager.getSelectedObj() instanceof Location) {
				((Location)(GameManager.getSelectedObj())).assignOrder(order, associatedLoc);
			} else if(GameManager.getSelectedObj() instanceof Ship) {
				((Ship)(GameManager.getSelectedObj())).assignOrder(order, associatedLoc);
			} else if(GameManager.getSelectedObj() instanceof Planet) {
				((Planet)(GameManager.getSelectedObj())).assignOrder(order, null);
			}
			GameManager.selectObj(null);
		} else if(upgradeItems.containsKey(e.getSource())) {
			if(GameManager.getSelectedObj() instanceof Location) {
				// retrieve CapitalShip from location
				Ship[] ships = ((Location)(GameManager.getSelectedObj())).getOccupants();
				for(int i = 0; i < ships.length; i++) {
					if(ships[i].getClass() == CapitalShip.class) {
						CapitalShip s = (CapitalShip) ships[i];
						s.assignOrder(Orders.UPGRADE, upgradeItems.get(e.getSource()));
						GameManager.selectObj(null);
						break;
					}
				}
			} else if(GameManager.getSelectedObj() instanceof Ship) {
				if(GameManager.getSelectedObj().getClass() == CapitalShip.class) {
					CapitalShip s = (CapitalShip) GameManager.getSelectedObj();
					s.assignOrder(Orders.UPGRADE, upgradeItems.get(e.getSource()));
					GameManager.selectObj(null);
				}
			} else if(GameManager.getSelectedObj() instanceof Planet) {
				((Planet)GameManager.getSelectedObj()).assignOrder(Orders.UPGRADE, upgradeItems.get(e.getSource()));
				GameManager.selectObj(null);
			}
		} else if(shipItems.containsKey(e.getSource())) {
			if(GameManager.getSelectedObj() != null) {
				GameManager.selectObj(null);
			}
			Ship s = shipItems.get(e.getSource());
//			if(s.getLoyalty() == TurnManager.currentPlayer) {
			GameManager.selectObj(s);
//			}
		} else if(locItem == e.getSource()) {
			if(GameManager.getSelectedObj() != null) {
				GameManager.selectObj(null);
			}
			//Below should be modified to allow us to select the location for the non-friendly forces, but not give orders.
			if(!associatedLoc.isInvisible()) {
				GameManager.selectObj(associatedLoc);
			}
		} else if(planetItem == e.getSource()) {
//			if(associatedLoc.getPlanet().getAlliance() == TurnManager.currentPlayer)
			GameManager.selectObj(associatedLoc.getPlanet());
		} else if(locSpecificItems.containsKey(e.getSource())) {
			if(locSpecificItems.get(e.getSource()) instanceof Orders) {
				// Regular order
				associatedLoc.getPlanet().assignOrder((Orders)(locSpecificItems.get(e.getSource())), null);
			} else if(locSpecificItems.get(e.getSource()) instanceof Ship) {
				// Upgrade Order
				associatedLoc.getPlanet().assignOrder(Orders.UPGRADE, (Ship)(locSpecificItems.get(e.getSource())));
			}
			GameManager.selectObj(null);
		}
		parent.repaint();
	}