Commit 2e072a54 authored by Cynthia Soimansoib's avatar Cynthia Soimansoib
Browse files

Merge branch 'feature/com/sendNewUserToOtherPlayers' into 'int/v2'

Resolve issue from V1 : method to send to other players that a new player

See merge request !46
parents b4231c51 48319565
......@@ -5,6 +5,7 @@ import main.java.client.network.messages.clientToServer.LoginUserToServerMessage
import main.java.client.network.messages.clientToServer.NewGameToServerMessage;
import main.java.common.message.MessageMeta;
import main.java.server.network.messages.serverToClient.ChatMessageToClientMessage;
import main.java.server.network.messages.serverToClient.NewUserAddedMessage;
import main.java.server.network.messages.serverToClient.ServerStateOnConnectionMessage;
import java.util.Optional;
......@@ -82,6 +83,9 @@ public class MessageClientController {
this.comCore.getComToDataClient().receivePlayersnGames(serverStateMessage.getUsersConnected(),
serverStateMessage.getGamesOnline());
break;
case "NewUserAddedMessage":
NewUserAddedMessage newUserMessage = (NewUserAddedMessage) message;
this.comCore.getComToDataClient().addNewUser(newUserMessage.getUserToAdd());
}
}
}
......@@ -93,7 +93,11 @@ public class MessageServerController {
List<UserLight> usersConnected = comCore.getComToData().getListUsers();
ServerStateOnConnectionMessage msg = new ServerStateOnConnectionMessage(loginMessage.getUserToAdd(),
usersConnected, gamesOnline);
MessageServerController.getInstance().sendListsToNewUser(msg);
this.sendListsToNewUser(msg);
//notify others of the fact a new user is available
NewUserAddedMessage userToAdd = new NewUserAddedMessage(loginMessage.getUserToAdd());
this.notifyNewUserAdded(userToAdd);
break;
case "ChatMessageToServerMessage":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment