There are two captains on any cruise ship at all times. One is the Ship’s Captain, and the second captain in command is called the Staff Captain. The Staff Captain will be on duty when the Captain is sleeping or needs to do an inspection, for example.
The main authority will, however, always rest with the Captain.