Coverage Summary for Class: ConnectEvent (it.polimi.ingsw.Server.Messages.Events.Internal)
Class |
Class, %
|
Method, %
|
Line, %
|
ConnectEvent |
0%
(0/1)
|
0%
(0/3)
|
0%
(0/5)
|
1 package it.polimi.ingsw.Server.Messages.Events.Internal;
2
3 import it.polimi.ingsw.Server.Messages.Events.ClientEvent;
4
5 import java.util.List;
6
7 /**
8 * This Event is generated when a lobby's client connects or disconnects and is sent to the lobby's clients.
9 */
10 public class ConnectEvent implements ClientEvent {
11 protected final String nickname;
12 protected final List<String> players;
13
14 /**
15 * Create the event
16 *
17 * @param affectedNickname the nickname of the player that just caused this event
18 * @param players the list of all connected players
19 */
20 public ConnectEvent(String affectedNickname, List<String> players) {
21 this.nickname = affectedNickname;
22 this.players = players;
23 }
24
25 /**
26 * Get the user that generated this event
27 *
28 * @return the nickname of the user that just caused this event
29 */
30 public String getNickname() {
31 return nickname;
32 }
33
34 /**
35 * Get the players connected to the lobby
36 *
37 * @return an Unmodifiable {@link List} containing players in the lobby
38 */
39 public List<String> getPlayers() {
40 return players;
41 }
42 }