# Class NewLeaderCommand

java.lang.Object
it.polimi.ingsw.is25am31.network.socket.serverClientMessages.NewLeaderCommand

All Implemented Interfaces:
  `ServerClientCommand`, `Serializable`

public class NewLeaderCommand extends Object implements ServerClientCommand, Serializable
Represents a command sent from the server to the client to inform about a change in game leader status.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NewLeaderCommand(boolean isNewLeader)`
  Constructs a new `NewLeaderCommand`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `execute(SocketClient client)`
  Executes the command on the `SocketClient`, instructing it to update its internal state and its user interface to reflect the new leader status.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### NewLeaderCommand

    public NewLeaderCommand(boolean isNewLeader)
    Constructs a new `NewLeaderCommand`.
    Parameters:
      `isNewLeader` - A boolean value indicating whether the client is the new game leader (`true`) or not (`false`).

- ## Method Details

  - ### execute

    public void execute(SocketClient client) throws Exception
    Executes the command on the `SocketClient`, instructing it to update its internal state and its user interface to reflect the new leader status.
    Specified by:
      `execute` in interface `ServerClientCommand`
    Parameters:
      `client` - The `SocketClient` instance on which the command will be executed.
    Throws:
      `Exception` - if an error occurs while the client processes the new leader information.