Removed all unnecessary server messages place
This commit is contained in:
parent
0b465ab800
commit
b045225a81
@ -23,8 +23,8 @@ public class ClientGameInfoHandler {
|
||||
public static final String gameOverGhostsWin = "Game over, ghosts win!";
|
||||
|
||||
//relevant for gui
|
||||
public static final String itsNightTime = "Please wait, ghosts are active";
|
||||
public static final String itsDayTime = "Please wait, humans are active";
|
||||
public static final String itsNightTime = "Listen closely, ghosts are active...";
|
||||
public static final String itsDayTime = "The humans are looking for you!";
|
||||
|
||||
//just messages
|
||||
|
||||
|
||||
@ -432,8 +432,9 @@ public class Client {
|
||||
try {
|
||||
if (data.contains("Game over")) {
|
||||
chatApp.getGameController().addMessageToNotificationText(data);
|
||||
} else if (!data.contains("$") && !data.contains("nickname")) {
|
||||
chatApp.getChatController().addChatMsgToServerView(data);
|
||||
}
|
||||
chatApp.getChatController().addChatMsgToServerView(data);
|
||||
Thread.sleep(5000);
|
||||
chatApp.getGameController().clearNotificationText();
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
@ -42,7 +42,6 @@ public class JClientProtocolParser {
|
||||
System.out.println(msg.substring(6));
|
||||
if (!msg.substring(6).equals("Your vote was invalid")) {
|
||||
c.notificationTextDisplay(msg.substring(6));
|
||||
|
||||
}
|
||||
break;
|
||||
case Protocol.printToClientChat:
|
||||
|
||||
@ -129,10 +129,7 @@ public class ClientHandler implements Runnable {
|
||||
String helper = this.getClientUserName();
|
||||
String oldName = getClientUserName();
|
||||
this.clientUserName = nameDuplicateChecker.checkName(newName);
|
||||
guiUpdateAll(Protocol.printToGUI + "$" + GuiParameters.nameChanged + "$" + oldName + ":"
|
||||
+ getClientUserName());
|
||||
sendMsgToClient(Protocol.changedUserName + "$" + newName);
|
||||
|
||||
broadcastAnnouncementToAll(helper + " has changed their nickname to " + clientUserName);
|
||||
try {
|
||||
getLobby().getGame().getGameState().changeUsername(helper, newName);
|
||||
@ -250,12 +247,6 @@ public class ClientHandler implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public static void guiUpdateAll(String msg) {
|
||||
System.out.println(msg);
|
||||
for (ClientHandler client : connectedClients) {
|
||||
client.sendMsgToClient(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts a non-chat Message to all clients in the same lobby. This can be used for server
|
||||
@ -476,9 +467,6 @@ public class ClientHandler implements Runnable {
|
||||
public void createNewLobby() {
|
||||
if (Lobby.clientIsInLobby(this) == -1) {
|
||||
Lobby newGame = new Lobby(this);
|
||||
guiUpdateAll(
|
||||
Protocol.printToGUI + "$" + GuiParameters.newLobbyCreated + "$" + getLobby().getLobbyID()
|
||||
+ ":" + getClientUserName());
|
||||
LOGGER.debug("Lobby: " + getLobby().getLobbyID() + ". In method createNewLobby()");
|
||||
} else {
|
||||
sendAnnouncementToClient("You are already in lobby nr. " + Lobby.clientIsInLobby(this));
|
||||
@ -496,8 +484,6 @@ public class ClientHandler implements Runnable {
|
||||
if (l != null) {
|
||||
if (l.getLobbyIsOpen()) {
|
||||
l.addPlayer(this);
|
||||
guiUpdateAll(Protocol.printToGUI + "$" + GuiParameters.addNewMemberToLobby + "$" + i + ":"
|
||||
+ getClientUserName());
|
||||
} else {
|
||||
sendAnnouncementToClient("The game in Lobby " + l.getLobbyID()
|
||||
+ " has already started, or the lobby is already full.");
|
||||
@ -518,8 +504,6 @@ public class ClientHandler implements Runnable {
|
||||
l.removePlayer(this);
|
||||
Game game = l.getGame();
|
||||
if(l.getAdmin().equals(getClientUserName())){
|
||||
//Lobby closed because admin left. Lobby must be removed from gui view
|
||||
guiUpdateAll(Protocol.printToGUI+"$"+GuiParameters.removeLobby+"$"+l.getLobbyID());
|
||||
}else{
|
||||
//client just leaves lobby
|
||||
}
|
||||
|
||||
@ -65,8 +65,6 @@ public class JServerProtocolParser {
|
||||
} catch (Exception e) {
|
||||
h.setUsernameOnLogin("U.N. Owen");
|
||||
}
|
||||
h.guiUpdateAll(Protocol.printToGUI + "$" + GuiParameters.newPlayerOnServer + "$"
|
||||
+ h.getClientUserName());
|
||||
break;
|
||||
case Protocol.nameChange:
|
||||
h.changeUsername(msg.substring(6));
|
||||
@ -92,9 +90,6 @@ public class JServerProtocolParser {
|
||||
break;
|
||||
case Protocol.createNewLobby:
|
||||
h.createNewLobby();
|
||||
h.guiUpdateAll(
|
||||
Protocol.printToGUI + "$" + GuiParameters.newLobbyCreated + "$" + h.getLobby()
|
||||
.getLobbyID() + ":" + h.getClientUserName());
|
||||
LOGGER.info("Here");
|
||||
break;
|
||||
case Protocol.listLobbies:
|
||||
|
||||
Reference in New Issue
Block a user