Commit 5c208cd9 authored by Stefano Grisendi's avatar Stefano Grisendi
Browse files

bugfix with more bugs

parent 90e3681b
......@@ -72,6 +72,7 @@ public class ServerController {
ArrayList<Connection> connections = getConnections(lobby);
cLobbyLeave command = new cLobbyLeave(leaveLobby(id, lobby.getID()));
leaveLobby(id, lobby.getID());
for(Connection c : connections){
......@@ -25,14 +25,16 @@ public class cLobbyLeave extends Command{
playerId = (int) receivedData.get(1);
Lobby lobby = net.getLobby(lobbyId);
data = net.leaveLobby(playerId, lobbyId); //Find new lobby without player
System.out.printf("Request from Player w. ID: %d to leave Lobby w. ID: %d \n", playerId, lobbyId);
for (Connection c : net.getConnections(lobby)) {
if (c.getID() != playerId) c.sendTCP(this); //send new lobby to other players
net.leaveLobby(playerId, lobbyId);
data = new Lobby(-1); //Send empty lobby to the player who left
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