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:
Seraina
2022-04-15 23:22:38 +02:00
parent 82a4e42b3c
commit d389a8fbb0
12 changed files with 137 additions and 41 deletions

View File

@@ -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:

View File

@@ -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());

View File

@@ -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());