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);
|
||||
break;
|
||||
case GuiParameters.updateLobbyString:
|
||||
if(!data.isEmpty()) {
|
||||
lobbyDisplayHandler.updateLobbies(data);
|
||||
ChatApp.getListController().updateList();
|
||||
} else {
|
||||
ChatApp.getListController().clearVBox();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
notificationTextDisplay(data);
|
||||
|
||||
@ -415,6 +415,7 @@ public class ClientHandler implements Runnable {
|
||||
Thread t = new Thread(game);
|
||||
t.start();
|
||||
l.addGameToRunningGames(game);
|
||||
sendMsgToClientsInLobby(Protocol.printToGUI + "$" + GuiParameters.viewChangeToGame + "$");
|
||||
} else {
|
||||
sendAnnouncementToClient("Only the admin can start the game");
|
||||
}
|
||||
|
||||
@ -115,7 +115,6 @@ public class JServerProtocolParser {
|
||||
break;
|
||||
case Protocol.startANewGame:
|
||||
h.startNewGame();
|
||||
h.sendMsgToClientsInLobby(Protocol.printToGUI + "$" + GuiParameters.viewChangeToGame + "$");
|
||||
break;
|
||||
case Protocol.listGames:
|
||||
h.listGames();
|
||||
|
||||
@ -27,6 +27,9 @@ public class LobbyUpdater implements Runnable{
|
||||
if (!Lobby.lobbies.isEmpty()) {
|
||||
client.sendMsgToClient(
|
||||
Protocol.printToGUI + "$" + GuiParameters.updateLobbyString + "$" + lobbiesAsString);
|
||||
} else{
|
||||
client.sendMsgToClient(
|
||||
Protocol.printToGUI + "$" + GuiParameters.updateLobbyString + "$");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user