Coverage Summary for Class: ClientConnected (it.polimi.ingsw.Server.Messages.ServerResponses)

Class Class, % Method, % Line, %
ClientConnected 0% (0/1) 0% (0/3) 0% (0/5)


1 package it.polimi.ingsw.Server.Messages.ServerResponses; 2  3 import java.io.Serial; 4 import java.util.List; 5  6 /** 7  * This Response is generated when a lobby's client connects and is sent to the lobby's clients. 8  * Therefore, it is {@link FixedStatusResponse} 9  */ 10 public class ClientConnected extends FixedStatusResponse { 11  @Serial 12  private static final long serialVersionUID = 303L; 13  private final String lastConnectedNickname; 14  15  private final List<String> players; 16  17  /** 18  * Create the response 19  * 20  * @param lastConnectedNickname the nickname of the player that just connected 21  * @param players the list of all connected players 22  */ 23  public ClientConnected(String lastConnectedNickname, List<String> players) { 24  this.lastConnectedNickname = lastConnectedNickname; 25  this.players = players; 26  } 27  28  /** 29  * Get the user that generated this response by connecting 30  * 31  * @return the nickname of the user that just connected to the lobby 32  */ 33  public String getLastConnectedNickname() { 34  return lastConnectedNickname; 35  } 36  37  /** 38  * Get the players connected to the lobby 39  * 40  * @return an Unmodifiable {@link List} containing all players in the lobby 41  */ 42  public List<String> getPlayers() { 43  return this.players; 44  } 45 }