Fixed it by using Game.map.getRoomTerrain and if(terrain.get(buildx, buildy) == 0 || terrain.get(buildx, buildy) == 2)