Updated 'LobbyPlayerJoinedMessage' class.

Updated the 'LobbyPlayerJoinedMessage' class by adding the 'host' attribute and its getter method to.
This commit is contained in:
Daniel Grigencha
2024-12-02 00:12:46 +01:00
parent bfc74ee126
commit ea6431faa4

View File

@@ -19,16 +19,23 @@ public class LobbyPlayerJoinedMessage extends ServerMessage {
*/
private final int id;
/**
* The flag is the new player is the host
*/
private final boolean host;
/**
* Constructs a new LobbyPlayerJoin instance with the specified player name.
*
* @param player the player joining the lobby
* @param id the id of the player
* @param id the id of the player
* @param host as the flag if the player is the host as a Boolean.
*/
public LobbyPlayerJoinedMessage(int id, Player player) {
public LobbyPlayerJoinedMessage(int id, Player player, boolean host) {
super();
this.player = player;
this.id = id;
this.host = host;
}
/**
@@ -37,6 +44,7 @@ public LobbyPlayerJoinedMessage(int id, Player player) {
private LobbyPlayerJoinedMessage() {
player = null;
id = 0;
host = false;
}
/**
@@ -57,6 +65,10 @@ public int getId(){
return id;
}
public boolean isHost() {
return this.host;
}
/**
* Accepts a visitor to process this message.
*