public void checkActive()
	{
		if (building.requires.length > 0 && !castle.getBuildings().containsAll(Arrays.asList(building.requires))) {
			buy.setEnabled(false);
			
			String requirestr = "<i>Wymaga: ";
			Set<core.CastleBuilding> diff = new HashSet<core.CastleBuilding>(Arrays.asList(building.requires));
			diff.removeAll(castle.getBuildings());
			System.out.println(diff);
			int i = 0;
			for (core.CastleBuilding b: diff) {
				if (i != 0) requirestr += ", ";
				requirestr += b.name;
				++i;
			}
			requirestr += "</i>";
			require.setText(requirestr);
			
			return;
		} else {
			require.setText("");
		}
		
		if (castle.isBuyed()) {
			buy.setEnabled(false);
			return;
		}
		if (player.getResource(core.ResourceType.GOLD) < building.cost.gold) {
			buy.setEnabled(false);
			return;
		}
		if (player.getResource(core.ResourceType.WOOD) < building.cost.wood) {
			buy.setEnabled(false);
			return;
		}
		if (player.getResource(core.ResourceType.ORE) < building.cost.ore) {
			buy.setEnabled(false);
			return;
		}
		System.out.println(castle.getBuildings());
		System.out.println(Arrays.asList(building.requires));
		if (castle.getBuildings().contains(building)) {
			buy.setEnabled(false);
			return;
		}		
	}