# Class PlayerJoinedCommand

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

All Implemented Interfaces:
  `ServerClientCommand`, `Serializable`

public class PlayerJoinedCommand extends Object implements ServerClientCommand, Serializable
Represents a command sent from the server to the client to notify about a new player joining the game.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PlayerJoinedCommand(String newPlayer, List<String> players)`
  Constructs a new `PlayerJoinedCommand`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `execute(SocketClient client)`
  Executes the command on the `SocketClient`, instructing it to update its view with the new player and the current list of players.

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

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

- ## Constructor Details

  - ### PlayerJoinedCommand

    public PlayerJoinedCommand(String newPlayer, List<String> players)
    Constructs a new `PlayerJoinedCommand`.
    Parameters:
      `newPlayer` - The nickname of the player who just joined.
      `players` - A list of all current player nicknames in the game.

- ## Method Details

  - ### execute

    public void execute(SocketClient client) throws Exception
    Executes the command on the `SocketClient`, instructing it to update its view with the new player and the current list of players.
    Specified by:
      `execute` in interface `ServerClientCommand`
    Parameters:
      `client` - The `SocketClient` instance to execute the command on.
    Throws:
      `Exception` - if an error occurs during player joined notification.