Removed some ToDos that are done and started creating a Spectator class and I'm in the process of ensuring only non kicked off passengers vote
This commit is contained in:
@@ -50,13 +50,11 @@ public class JClientProtocolParser {
|
||||
LOGGER.debug("Ghost received Vote request");
|
||||
System.out.println("Ghost Vote:");
|
||||
c.positionSetter(msg.substring(6));
|
||||
//TODO(Seraina): How can be enforced, that clients won't vote otherwise? Trigger a methode here that listens to input
|
||||
break;
|
||||
case Protocol.serverRequestsHumanVote:
|
||||
LOGGER.debug("Human received Vote request");
|
||||
System.out.println("Human Vote:");
|
||||
c.positionSetter(msg.substring(6));
|
||||
//TODO(Seraina): How can be enforced, that clients won't vote otherwise? Trigger a methode here that listens to input
|
||||
break;
|
||||
case Protocol.serverDeliversLobbyList:
|
||||
default:
|
||||
|
||||
@@ -77,11 +77,6 @@ public class ClientHandler implements Runnable {
|
||||
return socket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Needed to fill a train with client TODO: how do lobbies fit here?
|
||||
*
|
||||
* @return the HashSet of Connected Clients
|
||||
*/
|
||||
public static HashSet<ClientHandler> getConnectedClients() {
|
||||
return connectedClients;
|
||||
}
|
||||
@@ -300,7 +295,7 @@ public class ClientHandler implements Runnable {
|
||||
if(vote != Integer.MAX_VALUE) { //gets MAX_VALUE when the vote wasn't valid
|
||||
getLobby().getGame().getGameState().getClientVoteData().setVote(position,vote);
|
||||
LOGGER.debug("Player vote: " + vote);
|
||||
getLobby().getGame().getGameState().getClientVoteData().setHasVoted(position,true); //TODO: move clientVoteData to gamestate
|
||||
getLobby().getGame().getGameState().getClientVoteData().setHasVoted(position,true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +485,7 @@ public class ClientHandler implements Runnable {
|
||||
} catch (Exception e) {
|
||||
sendAnnouncementToClient(" - No running Games");
|
||||
}
|
||||
sendAnnouncementToClient("Finished Games");
|
||||
sendAnnouncementToClient("Finished Games:");
|
||||
try {
|
||||
for (Game finishedGame : Lobby.finishedGames) {
|
||||
sendAnnouncementToClient(" - " + finishedGame.getName() + ", Lobby" + finishedGame.getLobby().getLobbyID());
|
||||
|
||||
@@ -159,7 +159,7 @@ public class Lobby {
|
||||
*/
|
||||
public synchronized boolean addPlayer(ClientHandler client) {
|
||||
if (lobbyClients.size() < MAX_NO_OF_CLIENTS) {
|
||||
//todo: check that game hasn't started yet
|
||||
//todo: check that game hasn't started yet (handled in cleintHandler)
|
||||
if (clientIsInLobby(client) == -1) {
|
||||
lobbyClients.add(client);
|
||||
ClientHandler.broadcastAnnouncementToAll(client.getClientUserName() + " has joined lobby " + this.getLobbyID());
|
||||
|
||||
Reference in New Issue
Block a user