# Class LeaveGameCommand

java.lang.Object
it.polimi.ingsw.is25am31.network.socket.clientServerMessages.LeaveGameCommand

All Implemented Interfaces:
  `ClientServerCommand`, `Serializable`

public class LeaveGameCommand extends Object implements ClientServerCommand, Serializable
Represents a command sent from a client to the server to request to leave the current game.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LeaveGameCommand(UUID clientId)`
  Constructs a new `LeaveGameCommand`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `execute(SocketServer server)`
  Executes the command on the `SocketServer`, instructing it to remove the client identified by `clientId` from their current game.

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

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

- ## Constructor Details

  - ### LeaveGameCommand

    public LeaveGameCommand(UUID clientId)
    Constructs a new `LeaveGameCommand`.
    Parameters:
      `clientId` - The unique identifier of the client requesting to leave the game.

- ## Method Details

  - ### execute

    public void execute(SocketServer server) throws Exception
    Executes the command on the `SocketServer`, instructing it to remove the client identified by `clientId` from their current game.
    Specified by:
      `execute` in interface `ClientServerCommand`
    Parameters:
      `server` - The `SocketServer` instance on which the command will be executed.
    Throws:
      `Exception` - if an error occurs during the process of leaving the game on the server.