added getIdAndAdminForList() method in Lobby to facilitate sending a list of lobbies to a client

This commit is contained in:
Sebastian Lenzlinger 2022-04-08 17:09:17 +02:00
parent f910775f96
commit 922561d522

View File

@ -79,6 +79,21 @@ public class Lobby {
return this.lobbyID;
}
/**
* Builds a message for the LISTL command.
* @return a string formatted for the clients convenients.
*/
public String getIdAndAdminForList(){
StringBuilder response = new StringBuilder();
response.append("Lobby ID: ");
response.append(this.lobbyID);
response.append(" Admin Username: ");
response.append(getAdmin().getClientUserName());
response.append(System.lineSeparator());
LOGGER.info(response.toString());
return response.toString();
}
/**
* Adds a player to the lobby.
* TODO: ad an appropriate response. Currently hardcoded.