Made sure the start button only has functionality when in a lobby
This commit is contained in:
parent
126a2c21d3
commit
ec661365bd
@ -416,8 +416,12 @@ public class Client {
|
|||||||
removeLobbyFromGui(data);
|
removeLobbyFromGui(data);
|
||||||
break;
|
break;
|
||||||
case GuiParameters.updateLobbyString:
|
case GuiParameters.updateLobbyString:
|
||||||
lobbyDisplayHandler.updateLobbies(data);
|
if(!data.isEmpty()) {
|
||||||
ChatApp.getListController().updateList();
|
lobbyDisplayHandler.updateLobbies(data);
|
||||||
|
ChatApp.getListController().updateList();
|
||||||
|
} else {
|
||||||
|
ChatApp.getListController().clearVBox();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
notificationTextDisplay(data);
|
notificationTextDisplay(data);
|
||||||
|
|||||||
@ -415,6 +415,7 @@ public class ClientHandler implements Runnable {
|
|||||||
Thread t = new Thread(game);
|
Thread t = new Thread(game);
|
||||||
t.start();
|
t.start();
|
||||||
l.addGameToRunningGames(game);
|
l.addGameToRunningGames(game);
|
||||||
|
sendMsgToClientsInLobby(Protocol.printToGUI + "$" + GuiParameters.viewChangeToGame + "$");
|
||||||
} else {
|
} else {
|
||||||
sendAnnouncementToClient("Only the admin can start the game");
|
sendAnnouncementToClient("Only the admin can start the game");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,7 +115,6 @@ public class JServerProtocolParser {
|
|||||||
break;
|
break;
|
||||||
case Protocol.startANewGame:
|
case Protocol.startANewGame:
|
||||||
h.startNewGame();
|
h.startNewGame();
|
||||||
h.sendMsgToClientsInLobby(Protocol.printToGUI + "$" + GuiParameters.viewChangeToGame + "$");
|
|
||||||
break;
|
break;
|
||||||
case Protocol.listGames:
|
case Protocol.listGames:
|
||||||
h.listGames();
|
h.listGames();
|
||||||
|
|||||||
@ -27,6 +27,9 @@ public class LobbyUpdater implements Runnable{
|
|||||||
if (!Lobby.lobbies.isEmpty()) {
|
if (!Lobby.lobbies.isEmpty()) {
|
||||||
client.sendMsgToClient(
|
client.sendMsgToClient(
|
||||||
Protocol.printToGUI + "$" + GuiParameters.updateLobbyString + "$" + lobbiesAsString);
|
Protocol.printToGUI + "$" + GuiParameters.updateLobbyString + "$" + lobbiesAsString);
|
||||||
|
} else{
|
||||||
|
client.sendMsgToClient(
|
||||||
|
Protocol.printToGUI + "$" + GuiParameters.updateLobbyString + "$");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user